I'm looking for a way to completely remove the separator line in a UITableView when in the plain mode. This is done automatically in grouped, but this also changes the dimensions of the table in a way that is hard to measure. I have set the seperator line color to colorClear. But this does not completely solve the problem.
As I am trying to draw a custom background view in the cells, and I want the cells to be seamless, the one pixel line that remains in-between is causing me problems. Is there a more elegant workaround then using a grouped view and then stretching it?
This question is related to
objective-c
cocoa-touch
uikit
You can do this in the storyboard / xib editor as well. Just set Seperator to none.
In your viewDidLoad
:
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)])
{
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
In Swift:
tableView.separatorStyle = .None
There is bug a iOS 9 beta 4: the separator line appears between UITableViewCell
s even if you set separatorStyle
to UITableViewCellSeparatorStyleNone
from the storyboard. To get around this, you have to set it from code, because as of now there is a bug from storyboard. Hope they will fix it in future beta.
Here's the code to set it:
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
- (void)viewDidLoad {
[super viewDidLoad];
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
}
In the ViewDidLoad Method, you have to write this line.
tableViews.separatorStyle = UITableViewCellSeparatorStyleNone;
This is working Code.
I still had a dark grey line after attempting the other answers. I had to add the following two lines to make everything "invisible" in terms of row lines between cells.
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.separatorColor = [UIColor clearColor];
Source: Stackoverflow.com