zoukankan      html  css  js  c++  java
  • cell复用,状态改变

    - (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;
    }
  • 相关阅读:
    小节 +三元表达式
    continue
    break
    flag标签
    #region #endregion
    for 循环
    do while 有例句体会循环的真正原理
    while 循环
    前缀和与差分
    递归的循环实现
  • 原文地址:https://www.cnblogs.com/yipingios/p/4611304.html
Copyright © 2011-2022 走看看