我在我的应用程序中有多个UITableViews,在该列中是否有检测用户选择的单元格/行的方法?
同时,是否可以以编程方式取消选择单元格/行?
谢谢。
我在我的应用程序中有多个UITableViews,在该列中是否有检测用户选择的单元格/行的方法?
同时,是否可以以编程方式取消选择单元格/行?
谢谢。
获取表格当前选定的索引路径:
NSIndexPath *path = [tableView indexPathForSelectedRow];
取消当前选定的行:[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
这些都可以在UITableView的文档中轻松找到。也许下次你应该先查阅那里。
NSIndexPath *path = [tableView indexPathForSelectedRow];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:someIndexPath];
if(cell.isSelected) {
[tableView deselectRowAtIndexPath:someIndexPath animated:YES];
}