iOS TableView didSelectRowAtIndexPath选中某Cell后获取其Cell实例对象
2017-03-07 14:48
465 查看
在TableView上选中某个Cell会触发
[cpp] view
plain copy
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
该方法的传入参数是“NSIndexPath”类型,如何获得对应的Cell对象吗,方法如下:
[cpp] view
plain copy
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
<span style="font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 18px;">UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; </span>
}
之后就可以对相应的Cell进行操作了。
[cpp] view
plain copy
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
该方法的传入参数是“NSIndexPath”类型,如何获得对应的Cell对象吗,方法如下:
[cpp] view
plain copy
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
<span style="font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 18px;">UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; </span>
}
之后就可以对相应的Cell进行操作了。
相关文章推荐
- iOS TableView didSelectRowAtIndexPath选中某Cell后获取其Cell实例对象
- iOS TableView didSelectRowAtIndexPath选中某Cell后获取其Cell实例对象
- iOS TableView didSelectRowAtIndexPath选中某Cell后获取其Cell实例对象
- ios tableview didSelectRowAtIndexPath方法中,获取某个cell的实例
- iOS 开发,UITableViewController中手势关闭cell中的键盘。且不影响tableView中的 didSelectRowAtIndexPath 方法。
- iOS tableview获取当前选中的cell
- tableview获取选中cell对象
- Uitableview中didSelectRowAtIndexPath常用的获取cell信息的方法
- iOS中UITableView的cell点击事件不触发didSelectRowAtIndexPath
- IOS TableView的Delegate Methods-tableView didSelectRowAtIndexPath
- ios-tableView的touchesBegan事件和didSelectRowAtIndexPath方法
- iOS中获取用户所点击的位置信息,并通过这个位置信息得到tableView的中的cell的indexPath.section
- iOS中UITableView的cell点击事件不触发didSelectRowAtIndexPath
- iOS中UITableView的cell点击事件不触发didSelectRowAtIndexPath(汇总)
- 通过cell中的元素获取cell的indexPath以及长按tableview获取选中cell的indexPath
- [ios] tableView:cellForRowAtIndexPath: unrecognized selector sent to instance
- ios UITableView 获取点击cell对象
- iOS中添加UITapGestureRecognizer手势识别后,UITableView的didSelectRowAtIndexPath失效
- 获取静态TableView选中的cell来执行相应操作
- 获取tableview中当前选中的cell