Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>VERSION #1</strong></p> <pre><code>NSMutableDictionary *textFieldsDictionary = [NSMutableDictionary dictionary]; // SPOt THe DIFFERENCE HERE CGFloat txt_Pos_Y =20; for (int j=0; j&lt;20; j++) { UITextField *txtField = [[UITextField alloc] initWithFrame:CGRectMake(110, txt_Pos_Y, 100, 15)]; txtField.borderStyle = UITextBorderStyleRoundedRect; txtField.font = [UIFont systemFontOfSize:11]; txtField.tag = j; txtField.placeholder = @"Enter Value"; txtField.autocorrectionType = UITextAutocorrectionTypeNo; txtField.keyboardType = UIKeyboardTypeDefault; txtField.returnKeyType = UIReturnKeyDone; txtField.clearButtonMode = UITextFieldViewModeWhileEditing; txtField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; txtField.delegate = self; [scrollView addSubview:txtField]; [textFieldsDictionary setObject:txtField forKey:[NSString stringWithFormat:@"%d", j]]; // SPOT THE DIFFERENCE HERE [txtField release]; } </code></pre> <p>and:</p> <pre><code>-(void)CalculateMethod{ UITextField *txtField = [textFieldsDictionary valueForKey:[NSString stringWithFormat:@"%d", 1]]; double a = 3.1415f; txtField.text = [[NSString alloc] initWithFormat:@"%.4f", a]; } </code></pre> <hr> <p><strong>VERSION #2</strong></p> <p>you should change this method only.</p> <pre><code>-(void)CalculateMethod{ UITextField *txtField = nil; for (id temporarySubView in scrollView.subviews) { if ([temporarySubView isKindOfClass:[UITextField class]]) { if (((UITextField *)temporarySubView).tag == 1) { txtField = temporarySubView; break; } } } double a = 3.1415f; txtField.text = [[NSString alloc] initWithFormat:@"%.4f", a]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload