首页 > 其他 > 详细

tableView   cell 复用 第二种

时间:2014-09-20 02:25:06      阅读:393      评论:0      收藏:0      [点我收藏+]



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 复用 第二种

原文:http://qccccc.blog.51cto.com/6004423/1555345

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