用.xib文件自定义UITableViewCell

来源:互联网 发布:使命召唤ol宏连点编程 编辑:程序博客网 时间:2024/05/21 06:28

1.选中Table View Cell,打开Attribute Inspector,将Identifier设置为CustomCellIdentifier:

2.在cell生成函数中输入:

   static NSString *CustomCellIdentifier = @"CustomCellIdentifier";        static BOOL nibsRegistered = NO;    if (!nibsRegistered) {        UINib *nib = [UINib nibWithNibName:@"CustomCell" bundle:nil];        [tableView registerNib:nib forCellReuseIdentifier:CustomCellIdentifier];        nibsRegistered = YES;    }        CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];            return cell;



详情:http://www.howzhi.com/group/iosDevelop/discuss/2068

0 0
原创粉丝点击