UITableView加载几种不一样的cell

相似上面的图片,一个滚动视图上颌不少个模块,之前用scrollview感受不是很方便,想了下,其实能够用collectionview或者tableview的css

UITableView举例
url

其实就是一个 tableview加载几个不一样的cell,能够根据惟一标示来断定spa

注册:orm

    [_tableveiw registerClass:[CustomCell class] forCellReuseIdentifier:@"cellID"];blog

    [_tableveiw registerClass:[CustomCell1 class] forCellReuseIdentifier:@"cellID1"];图片

    [_tableveiw registerClass:[CustomCell2 class] forCellReuseIdentifier:@"cellID2"];it

加载io

    UITableViewCell *cell = nil;table

    if (indexPath.section == 0) {class

        cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"];

        CustomCell *newcell = (CustomCell *)cell;

        newcell.label.text = @"00000";

        

    }else if (indexPath.section == 1){

        cell = [tableView dequeueReusableCellWithIdentifier:@"cellID1"];

    }else {

        cell = [tableView dequeueReusableCellWithIdentifier:@"cellID2"];

    }

    

    return cell; 

相关文章
相关标签/搜索