Removing cell borders from a section of grouped-style UITableView

后端 未结 15 2119
南旧
南旧 2020-12-04 07:56

I have a UITableViewController initialized with the grouped style and having multiple sections. For one of these sections, I\'d like its constituent cells to be completely t

相关标签:
15条回答
  • 2020-12-04 08:18
     UIView *backView = [[UIView alloc] initWithFrame:CGRectZero];
     backView.backgroundColor = [UIColor clearColor];
     cell.backgroundView = backView;
     cell.backgroundColor = [UIColor clearColor];
     [cell.contentView addSubview:imageView];
    
    0 讨论(0)
  • 2020-12-04 08:21

    Set the backgroundView of the cell to nil. For a grouped table, the cell image is part of that view.

    0 讨论(0)
  • 2020-12-04 08:23

    NOTE: This doesn't appear to be working in iOS7 and above. For iOS7 try this answer.

    For iOS6 and below, to remove the grouped background from a cell in a grouped table view cell:

    This didn't work

    cell.backgroundView = nil; // Did Not Work
    

    This did

    cell.backgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
    

    If you have moved to ARC (I've heard this works, but haven't tested it)

    cell.backgroundView = [UIView new];
    
    0 讨论(0)
提交回复
热议问题