VC引用Cell

183 阅读1分钟

两步骤: 1:在VC界面import相关Cell.h文件; 2:写入方法,更改相关Cell名。

代码如下:

- (UITableViewCell *)tableView:(UITableView *)tableView  
   cellForRowAtIndexPath:(NSIndexPath *)indexPath           
{
   static NSString *str = @"WZCollectCell";
   WZCollectCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
   if(!cell){
       cell = [WZCollectCell loadFromNib];
       cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
return cell;
}

相关实例如下:

至此,完。