vendredi 6 mars 2015

Adding a UITextField to a UITableViewCell

Hey I've been looking for this problem and also found some topics to my question but I'm obviously not getting what I'm doing wrong, so here's my problem I have a UITableViewCell and want to add a UITextFiel to it. So I setup a TextFiel and add it to the Cell in the cellForRowAtIndexPathRow:, but when I select the row or to be precisely the TextField no keyboard or shows up and I also can't see a placeholder.


Here's my code:



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectZero];

textField.delegate = self;
textField.placeholder = NSLocalizedString(@"Description", nil);
[cell addSubview:textField];

return cell;
}

- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
}


I would appreciate your help ;)




Aucun commentaire:

Enregistrer un commentaire