Note that there are some explanatory texts on larger screens.

plurals
  1. PODetermine the section of the tabbed UITextField
    primarykey
    data
    text
    <p>This is a tricky one:</p> <p>I have:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ... //Textfield: UITextField *theTextField = [[UITextField alloc] initWithFrame:CGRectMake(200, 10,self.tableView.frame.size.width - 250, 30)]; theTextField.adjustsFontSizeToFitWidth = YES; theTextField.textColor = [UIColor blackColor]; theTextField.placeholder = [NSString stringWithFormat:@"%@ (mm)",[dictionarySub objectForKey:@"Title"]]; theTextField.keyboardType = UIKeyboardTypeDefault; theTextField.returnKeyType = UIReturnKeyDone; theTextField.backgroundColor = [UIColor whiteColor]; theTextField.autocorrectionType = UITextAutocorrectionTypeNo; theTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; // no auto capitalization support theTextField.textAlignment = UITextAlignmentLeft; theTextField.tag = indexPath.row; theTextField.delegate = self; theTextField.clearButtonMode = UITextFieldViewModeWhileEditing; // no clear 'x' button to the right [theTextField setEnabled: YES]; //Maak cell unselectable cell.selectionStyle = UITableViewCellSelectionStyleNone; [cell addSubview:theTextField]; } </code></pre> <p>and:</p> <pre><code>- (BOOL)textFieldShouldReturn:(UITextField *)textField { //Textfield ophalen NSIndexPath *indexPath = [NSIndexPath indexPathForRow:textField.tag inSection:0]; UITableViewCell *selectedCell = [self.tableView cellForRowAtIndexPath:indexPath]; editingCell = selectedCell; //Dictionary ophalen NSArray *subViewItemsToUse; subViewItemsToUse = [self getSubViewItemsToUse:indexPath]; NSDictionary *dictionarySub = [subViewItemsToUse objectAtIndex:textField.tag]; //Regex ophalen NSString *regularExpressionString = [dictionarySub objectForKey:@"Regex"]; //predicate opstellen NSPredicate *regExPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regularExpressionString]; BOOL myStringMatchesRegEx = [regExPredicate evaluateWithObject:textField.text]; if(!myStringMatchesRegEx &amp;&amp; [textField.text length] &gt; 0 &amp;&amp; [regularExpressionString length] &gt; 0) { textField.backgroundColor = [UIColor redColor]; editingCell.backgroundColor = [UIColor redColor]; } else { editingCell.backgroundColor = [UIColor whiteColor]; textField.backgroundColor = [UIColor whiteColor]; } ... </code></pre> <p>But i need the section of the cell where the textfield is in... So not: <code>NSIndexPath *indexPath = [NSIndexPath indexPathForRow:textField.tag inSection:0];</code> I cant use the .tag property anymore because i added the row to that. How can i get the number of the section?</p>
    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.
 

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