tableview 用xib加载cell

来源:互联网 发布:手机淘宝看评价管理 编辑:程序博客网 时间:2024/05/22 17:35

基本上没有过xib写过项目,觉得都落伍了,有条件还是得拿来练练 


1、拉过来一个cell 并设置下class(意为cell归属于哪个类)
2、右侧设置下identifier

3、cell上面拖一个lable进来
4、初始化cell

static NSString *identifier = @"PlayListCellIdentifier";//这个identifier跟xib设置的一样

    PlayListCellTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];

   

    if (cell == nil) {

        cell= [[[NSBundle  mainBundle]  loadNibNamed:@"PlayListCellTableViewCell" owner:self options:nil]  lastObject];

    }




0 0