静态cell和动态cell混用

1.静态cell常用设置界面的,因为设置界面的的数据一般是死的,用静态cell比较方便搭建


2.现在实现在Storbord实现上面的cell是静态的cell,下面的cell是动态cell,实现两者混用的效果

    1>创建一个静态cell在tableView

主要是在

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

   //表示静态cell

    if (indexPath.section == 0) {

        return [super tableView:tableView cellForRowAtIndexPath:indexPath];

    }else{

   //表示动态cell 

        HTWarningViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HTWarningViewCell"];

        return cell;


    } 

}

//表示cell中indexPath

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    //表示动态cell在section  为  1  静态cell的section 0

    if (section == 1) {

         return self.selectedUserList.count;

    }

    return [super tableView:tableView numberOfRowsInSection:section];

    

}

//表示cell的内容缩进

- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{

    //表示动态cell在section  为  1  静态cell的section 0

if (indexPath.section == 1) {

            return 10;

    }

    return indexPath.row;

}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值