码迷,mamicode.com
首页 > 其他好文 > 详细

TableView使用xib的方法创建Cell

时间:2015-09-07 14:23:37      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

//书籍
        static NSString *bookCellId = @"bookCellId";
        BookCell *cell = [tableView dequeueReusableCellWithIdentifier:bookCellId];
        if (nil == cell) {  //不能用alloc init来初始化
            //沙盒目录
            //第一个参数:xib文件的名字
            //第二个参数:cell的所有者(self或者nil)
            //第三个参数:cell初始化的时候传递的附加参数(一般传nil)
            cell = [[[NSBundle mainBundle] loadNibNamed:@"BookCell" owner:nil options:nil] lastObject];
        }
        //显示数据
        BookModel *model = _bookArray[indexPath.row-1];
        [cell configModel:model];
        
        //修改选中状态
        cell.selectionStyle = UITableViewCellSelectionStyleBlue;
        return cell;

TableView使用xib的方法创建Cell

标签:

原文地址:http://www.cnblogs.com/liaods/p/4788661.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!