首页 > 其他 > 详细

cell复用,状态改变

时间:2015-06-30 20:20:20      阅读:111      评论:0      收藏:0      [点我收藏+]
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"LeftTableViewCell";
    
    LeftTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"LeftTableViewCell" owner:nil options:nil]lastObject];
    }else{//cell重用问题解决
        
        if (indexPath == lastIndexPath) {//点击cell的时候保存的
            cell.contentView.backgroundColor = [UIColor redColor];
        }else{
            cell.contentView.backgroundColor = [UIColor clearColor];
        }
    }
    cell.nameLabel.text = self.dataArray[indexPath.row];
    return cell;
}

 

cell复用,状态改变

原文:http://www.cnblogs.com/yipingios/p/4611304.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!