UITableView检测选定的单元格? [英] UITableView Detect Selected Cell?

查看:128
本文介绍了UITableView检测选定的单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用中有多个UITableViews,有没有一种方法可以检测用户在该列中选择了哪个单元格/行?

I have multiple UITableViews in my app, is there a method of detecting which cell/row the user has selected in that column?

也可以以编程方式编写取消选择一个单元格/行?

Also is it possible to programatically deselect a cell/row?

谢谢。

推荐答案

目前获取选择的表索引路径:

Get currently selected index path for a table:

NSIndexPath *path = [tableView indexPathForSelectedRow];

取消选择当前选定的行:

Deselect currently selected row:

[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];

这篇关于UITableView检测选定的单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆