tableView中cell复用的方法

这篇文章主要介绍tableView中cell复用的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

cell 第二种方法 (1)
static NSString * ideng = @"reuse";

 cell 第二种方法 (2)
        注册复用cell (cell 的类型和标识符) (可以同时注册多个cell , 方法相同 , 一定要保证标识符是不一样的)
       注册到了tableView的复用池
        [self.tableView registerClass:[TableViewCell class] forCellReuseIdentifier:ideng];

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
 
   

cell 第二种方法 (3)

    用复用池中找cell (1.cell的标识符 , 2. indexPath:决定系统用不用给你创建cell , 不用创建的话 , 复用之前的cell )
    
 

    TableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ideng forIndexPath:indexPath];
        

    return cell;
    
}


以上是“tableView中cell复用的方法”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!