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; 

相關文章
相關標籤/搜索