iphone - 如何在 iphone 的 tableview 中找到 accessoryType 单击

标签 iphone objective-c ios

我需要在 accessoryType 上做一些事情,在 iphone 的 tableview 中单击。如何找到 accessoryType 在 iphone 中的 UITableView 单击。 p>

最佳答案

你需要定义单元格的accessoryType

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

像这样

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

这个accessoryType的行选择方法是

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath

但是如果您要为单元格定义任何其他 accessoryType,则可以使用此方法。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

关于iphone - 如何在 iphone 的 tableview 中找到 accessoryType 单击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5138272/

相关文章:

iphone - 在选取器 View 中未选择第一个值

iOS - 我应该在这个 block 中调用 "weakSelf"吗?

android - 适用于 Spritekit

ios - 可以让 titleView 接受点击手势吗?

ios - 如何在应用程序中保存凭据以允许自动填充功能?

iphone - NSDateFormatter stringFromDate, dateFromString 都返回 nil

iphone - 3.5 屏幕上的 View 大小错误

ios - 如何创建自定义选项卡式 View ,如 Peach 应用程序中的 View

objective-c - 为什么我的 NSTableView 数据源方法出现 EXE_BAD_ACCESS 错误?

ios - 按名称定义和转换类