美文网首页
iOS UITableView -Cell

iOS UITableView -Cell

作者: 小的小碰撞 | 来源:发表于2017-08-23 10:49 被阅读0次

样式1

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    XMGDealCell *cell = [XMGDealCell cellWithTableView:tableView];
    
    // 取出模型数据
    cell.deal = self.deals[indexPath.row];
    
    return cell;
}



+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"deal";
    // 创建cell
    XMGDealCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
       cell = [[XMGDealCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
   }
    return cell;
}

// 1.在initWithStyle:reuseIdentifier:方法中添加子控件

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
}

相关文章

网友评论

      本文标题:iOS UITableView -Cell

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