[contactCell.no5 addTarget:self action:[self performSelector:@selector(numberEdit:cellIndex:) withObject:contactCell.no5 withObject:[NSNumber numberWithInteger:indexPath.row]] forControlEvents:UIControlEventValueChanged];
in contactCell.no5“no5 is textfield”和“contactCell is uitableviewcell object”...
功能 - >
-(void)numberEdit:(UITextField *)textField cellIndex:(NSNumber *)row
{
[numberList removeObjectAtIndex:[row integerValue]];
NSLog(@"%@",numberList.description);
[numberList insertObject:textField.text atIndex:[row integerValue]];
NSLog(@"%@",numberList.description);
}
答案 0 :(得分:0)
试试这个
如果你有这样的文本字段:
UITextField *contactCell;
你需要添加targetLikeThis
[contactCell addTarget:self action:@selector(numberEdit:cellIndex:) forControlEvents:UIControlEventValueChanged];
堡垒自定义行动:
-(void)numberEdit:(UITextField *)textField cellIndex:(NSNumber *)row
{
[numberList removeObjectAtIndex:[row integerValue]];
NSLog(@"%@",numberList.description);
[numberList insertObject:textField.text atIndex:[row integerValue]];
NSLog(@"%@",numberList.description);
}