iOS UITableView

获取Cell以及获取当前选中的Cell

//获取cell 
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];  
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];  
//获取当前选中cell  
NSIndexPath* indexPath = [self.tableView indexPathForSelectedRow];  

tableview显示数据,数组为空时,tableview依然显示虚线问题。
需要给tableview的footview一个view。如:

tableView.tableFooterView = [[UIView alloc]init];

项目需求需要点击tableview时改变cell里的控件图片和状态

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{//重写高亮函数
    if (highlighted) {
        self.playImg.image = [UIImage imageNamed:@"icon_video_news_pre"];
        self.contentView.backgroundColor = RGB(251, 233, 206);
    }else{
        self.playImg.image = [UIImage imageNamed:@"icon_video_news_normal"];
        self.contentView.backgroundColor = RGBA(248, 248, 248, 1);
    }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容