iOS Dev (57) 解决UITableView重绘导致重叠的问题

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

{

    NSString * cellID = @"basePlayerControlSelected";

 

UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID];

 

if (cell == nil)

{

cell = [[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:cellID];

    }

    else

    {

        while ([cell.contentView.subviews lastObject] != nil) {

            [(UIView*)[cell.contentView.subviews lastObject] removeFromSuperview];  //删除并进行重新分配

        }

    }

    

    // TODO

}

参考:http://blog.sina.com.cn/s/blog_75b6e3a601015u4s.html

猜你喜欢

转载自prevention.iteye.com/blog/2025285
57
Dev
今日推荐