iphone - UITableView/UITableViewCell 点击事件响应?

我一直在谷歌上搜索,试图弄清楚当 UITableView 中的一行(或单元格)被点击时调用哪种事件句柄,但无法弄清楚。我正在尝试更改单元格被点击时的图像属性。

谢谢。

最佳答案

点击表格行时有两种可能的事件:选择行和附件 View (通常是“更多详细信息”类型的操作)。

只要你为UITableView注册了一个delegate,就可以实现下面的操作,并且在touch时会被调用:

// Tap on table Row
- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath { ... }

// Tap on row accessory
- (void) tableView: (UITableView *) tableView accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *) indexPath{ ... }

https://stackoverflow.com/questions/1889200/

相关文章:

iphone - 什么是-[NSString sizeWithFont :forWidth:line

ios - 计算两个 CLLocationCoordinate2D 之间的方位

ios - 在objective-c中导入swift类,-Swift.h文件未找

iphone - 在 Objective-C 中随机化 NSArray 的规范方法

objective-c - 适合 UILabel 中的文本

iphone - 如何以编程方式区分 iphone 4 和 iphone 4S?

objective-c - 如何从 C 方法调用 Objective-C 方法?

objective-c - Objective C 中的多个委托(delegate)

iphone - animateWithDuration :animations: block ma

iphone - 如何使用第一个字符作为部分名称