码迷,mamicode.com
首页 > 其他好文 > 详细

如何获取tableview中当前选中的cell

时间:2016-02-14 12:53:18      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

当我们点击某个cell时,会执行下面这个方法,方法中调用另一方法执行具体操作:

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

    

    if (0 == indexPath.section) {

        [self btnActionForUserSetting:self];

        

    } 

 
在下面方法中怎样获取刚刚选中的那个cell,并修改它的内容呢?

- (void)btnActionForUserSetting:(id) sender {

 

 NSIndexPath *indexPath = [self.tableViewindexPathForSelectedRow];

 UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];

 cell.textLabel.text= @"abc";

}

这样,被点击的cell的内容就被修改了。

如何获取tableview中当前选中的cell

标签:

原文地址:http://www.cnblogs.com/OIMM/p/5188868.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!