I have a UITableViewController that I display modally. When the user clicks on any cell, I need to capture that choice and dismiss the view controller. The weird thing is that the first cell that is clicked is not recognized. When the user clicks on another cell, that is recognized and everything works as intended. Obviously, I need the first click to be the one that is recognized. What am i doing wrong?
我有一个UITableViewController,我以模态方式显示。当用户点击任何单元格时,我需要捕获该选项并关闭视图控制器。奇怪的是,单击的第一个单元格无法识别。当用户点击另一个单元格时,该单元被识别并且一切都按预期工作。显然,我需要第一次点击才能被认可。我究竟做错了什么?
- (void) tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"cell clicked");
// capture user selection and return to previous screen
[self dismissViewControllerAnimated:YES completion:nil];
}
1 个解决方案
#1
6
You are using tableView:didDeselectRowAtIndexPath:
instead of tableview:didSelectRowAtIndexPath:
;)
您正在使用tableView:didDeselectRowAtIndexPath:而不是tableview:didSelectRowAtIndexPath :;)
#1
6
You are using tableView:didDeselectRowAtIndexPath:
instead of tableview:didSelectRowAtIndexPath:
;)
您正在使用tableView:didDeselectRowAtIndexPath:而不是tableview:didSelectRowAtIndexPath :;)