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
cell.backgroundView = [UIView new];
Works like a charm! Tested! iOS6
Setting a content view also gets rid of the border. Set your custom view to cell.contentView.
This code worked for me :)
[self.tableView setSeparatorColor:[UIColor clearColor]];
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
The following hack works in iOS 7 – for now. :)
Subclass UITableViewCell
, and use this cell for the section that shouldn't have separators.
Override the addSubview
method in your cell subclass:
-(void)addSubview:(UIView *)view
{
// The separator has a height of 0.5pt on a retina display and 1pt on non-retina.
// Prevent subviews with this height from being added.
if (CGRectGetHeight(view.frame)*[UIScreen mainScreen].scale == 1)
{
return;
}
[super addSubview:view];
}
cell.backgroundColor = [UIColor clearColor];
cell.backgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
The easiest way to remove cell borders from a section of grouped-style UITableView:
[tableViewOutlet setBackgroundView:nil];
in the viewDidLoad method.