您的位置:首页 > 移动开发 > IOS开发

ios 获取当前或指定的cell

2017-07-06 11:10 169 查看
我们就给cell一个代理方法

[objc] view
plain copy

// 点击按钮  

- (IBAction)click:(UIButton *)sender {  

      

    if ([self.delegate respondsToSelector:@selector(MKJTableView:clickButton:)]) {  

        [self.delegate MKJTableView:self clickButton:sender];  

    }  

}  

让Controller实现这个代理

[objc] view
plain copy

// cell的代理方法  

- (void)MKJTableView:(MKJTableViewCell *)cell clickButton:(UIButton *)touchBtn  

{  

     

}  

// 这里的2和0可以根据需要求更改 这里就是第0段,第2行  

NSIndexPath *  indexPath = [NSIndexPath indexPathForRow:2 inSection:0];  

UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:indexPath];
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: