【发布时间】:2018-01-12 07:06:18
【问题描述】:
我有一个表格视图单元格。在那我有一个文本字段。当我从选择器视图中选择一个值时,它会出现在每个文本字段中。我将如何在带有单元格的 Tableview 中获取活动的文本字段。我试过了:
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
CustomCell *currentCell = (CustomCell *) textField.superview.superview;
NSIndexPath *currentIndexPath = [self.tableView indexPathForRowAtPoint:currentCell.center];
NSLog(@"%@",currentIndexPath);
}
【问题讨论】:
-
在
cellForRowAtIndexPath分享您的代码 -
代替
indexPathForRowAtPoint,您可以使用标签来索引路径并使用cellForRowAtIndexPath 获取该特定单元格并仅重新加载该特定行reloadrowsatindexpaths -
你在使用动态uitableviewcell吗?
-
这个委托方法是在单元格中还是在视图控制器中?
标签: ios objective-c uitableview textfield