Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So todays morning was very good for code soultions and finally I came up with one for this problem:</p> <p>I got rid of storyboard for this cell and changed all pointers of custom cell to strong (so I own them).</p> <p>Dequeque reusable cell was recreating UITextField from deleted rows making controller confused about ownership and becoming first responder.</p> <p>be aware that creating them inside of cell init didn't do the trick.</p> <p>TextField MUST be created and added as subview (also assigned to strong pointer so I get control over it later).</p> <p>Here is some code:</p> <pre><code> VMEditableTableViewCell *cell = [[VMEditableTableViewCell alloc] init]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; UIImage *bulletImage = [UIImage imageNamed:@"common_ico_dot.png"]; UIImageView *bulletImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20,17,10, 10)]; bulletImageView.image = bulletImage; UIImage *tickImage = [UIImage imageNamed:@"common_green_tick.png"]; UIImageView *tickImageView = [[UIImageView alloc] initWithFrame:CGRectMake(cell.bounds.size.width-30, 17, tickImage.size.width, tickImage.size.height)]; tickImageView.image = tickImage; tickImageView.hidden = YES; UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(60, 10, 227, 30)]; textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocapitalizationType = UITextAutocapitalizationTypeNone; textField.delegate = self; textField.font = [UIFont fontWithName:@"Maven Pro" size:17.0]; textField.tag = indexPath.row; [textField setBorderStyle:UITextBorderStyleNone]; [cell addSubview:bulletImageView]; cell.bulletImageView = bulletImageView; [cell addSubview:tickImageView]; cell.tickImageView = tickImageView; if (cell.editableTF == nil) { [cell addSubview:textField]; cell.editableTF = textField; } </code></pre>
 

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