J'ai un tableView
dynamique. Un couple de cellules a un textField
.UITableView obtention de l'indexPath dans textFieldDidBeginEditing:
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(15,10,260,40)];
textField.delegate = self;
[cell addSubview:textField];
Je suis en train d'obtenir le indexPath
dans textFieldDidBeginEditing
. Voici mon code
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
CGPoint location = [self.view.superview convertPoint:self.view.center toView:self.orderTableView];
NSIndexPath *indexPath = [self.orderTableView indexPathForRowAtPoint:location];
NSLog (@"IndexPath %@", indexPath);
NSLog (@"IndexPath.ROW %i", indexPath.row);
}
Je les 4 premières cellules (indice 0 - 3) qui sont des cellules standard. Après les 4 premières cellules, je peux dynamiquement avoir jusqu'à 3 cellules personnalisées avec UITextField.
Après la UIViewController apparaît avec le UITableView, et peu importe ce que TableViewCell avec UITextField je clique sur le NSLog garde ci-dessous me montrant les éléments suivants:
2013-07-09 07:21:40.910 MyApp[2884:c07] IndexPath <NSIndexPath 0xa0a5d60> 2 indexes [0, 3]
2013-07-09 07:21:40.910 Mypp[2884:c07] IndexPath.ROW 3
Comment puis-je obtenir le indexPath
correct de la cellule avec UITextField
qui a appelé le clavier?
cool :) .. réponse correcte –