UITableView / UITableViewCell点击事件响应? [英] UITableView/UITableViewCell tap event response?

查看:90
本文介绍了UITableView / UITableViewCell点击事件响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在谷歌搜索,试图找出当UITableView中的一行(或单元格)被轻敲时调用的事件句柄类型,但是无法弄明白。我试图在点击时更改单元格的图像属性。

I've been googling around to try to figure out what sort of event handles are called when one row (or cell) in a UITableView is tapped, but haven't been able to figure it out. I'm trying to change the image property of the cell when it's tapped.

谢谢。

推荐答案

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

There are two possible events when a table row is tapped: selecting the row and the accessory view (usually the "more details" type action).

只要您为UITableView注册了一个委托,就可以实现以下内容并在触摸时调用:

As long as you have registered a delegate for the UITableView, the following can be implemented and will be called on a touch:

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

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

这篇关于UITableView / UITableViewCell点击事件响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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