UITableView里的数据刷新和位置更新

在这个函数里设置数据源,只要是每个cell的一直变化的元素都要通过这里设置

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

{

    static NSString *CellIdentifier = @"Cell";

    IssueViewCell *cell = (IssueViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[[IssueViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

        cell.accessoryType = UITableViewCellAccessoryNone;

        cell.selectionStyle = UITableViewCellSelectionStyleNone;

    }

    IssueData *issueData = [self.items objectAtIndex:indexPath.row];

    [cell setData:issueData];

    return cell;

}

在上个函数 [cell setData:issueData] 里给UItableViewCell的各个元素赋值,如果有些元素在特殊情况下不显示,那么需要把这些view要移除父视图的。

    for (UIView *view in self.subviews) {

        [view removeFromSuperview];

    }

而设置tableviewcell里元素的位置是在- (void)layoutSubviews函数里实现的,每次滑动的时候都会执行该函数的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值