美文网首页
iOS 中 cell的用法

iOS 中 cell的用法

作者: 你我他_1180 | 来源:发表于2018-08-23 11:32 被阅读0次

//首先cell方法

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

{

    //cell复用,唯一标识

    staticNSString*identifier =@"Cell";

    //先在缓存池中取

    UITableViewCell*cell = [tableViewdequeueReusableCellWithIdentifier:identifier];

    //缓存池中没有再创建,并添加标识,cell移出屏幕时放入缓存池以复用

    if(cell ==nil) {

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier];

}

    returncell;

}

相关文章

网友评论

      本文标题:iOS 中 cell的用法

      本文链接:https://www.haomeiwen.com/subject/wxppiftx.html