mercredi 24 juin 2015

UILabel and UITextField overlapping in the same cell

In one UITableViewCell I have UILabel and UITextField like this:

As you can see the UITextField is aligned to the right. After I write something in the text field it overlaps.

How can I avoid this?

And this code snippets are how to fill cell

cell.textLabel.text = R_NAME_CLIENT_NAME;
        self->clientNameLabel = cell.textLabel;
       [self createTextField:&clientName WithDefaultText:@"none" WithText:@"" InCell:cell IndexPath:indexPath];

  • (void) createTextField:(UITextField**)textField WithDefaultText:(NSString*)defaultText WithText:(NSString*)text InCell:(UITableViewCell*)cell IndexPath:(NSIndexPath*)indexPath{ *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 11, cell.frame.size.width - 20, 20)]; (*textField).font = [UIFont fontWithName:@"Arial-ItalicMT" size:17]; }

Possible duplicate did not help me.

See more ..

Aucun commentaire:

Enregistrer un commentaire