怎么获取TableView选中行的Text

2025-05-19 04:49:38
推荐回答(2个)
回答1:

调用下面这个方法。
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
UITableViewCell *cell = (UITableViewCell *)[[textField superview] superview];
NSIndexPath *indexPath = [questionTableView indexPathForCell:cell];

NSLog(@"%d",indexPath.row);
}
就可以了。

回答2:

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
UITableViewCell *cell = (UITableViewCell *)[[textField superview] superview];
NSIndexPath *indexPath = [questionTableView indexPathForCell:cell];

NSLog(@"%d",indexPath.row);
}
我在网上找的,试试这个