I have implemented UITableView
with coding. I have also set UITableViewCellSeparatorStyleNone
. It is hiding for iOS8 and below but not hiding with iOS9 Beta.

- 2,214
- 23
- 29

- 1,279
- 1
- 11
- 29
-
1possible duplication http://stackoverflow.com/questions/31145103/ios-swift-remove-uitableview-cell-separator-space/31145169#31145169 – Özgür Ersil Jul 15 '15 at 11:30
-
Its not duplicate of mentioned question. The result I want to achieve is far different than the result achieved in that question. – Piyush Hirpara Jul 15 '15 at 11:47
-
Check this answer out: http://stackoverflow.com/a/25877725/1268426 – Dree Jul 15 '15 at 12:27
-
1I DONT WANT TO CHANGE THE INSET OF SEPARATOR. I WANT TO HIDE IT. – Piyush Hirpara Jul 15 '15 at 12:57
-
Sounds like a bug. File a radar at bugreporter.apple.com – dasdom Jul 15 '15 at 14:12
-
Filed a radar, 21933047: http://www.openradar.me/radar?id=5027942857965568 – Matthew Jul 22 '15 at 00:46
9 Answers
Please set the separator style to None in layoutSubviews method.
When constraints-based layout is used the base implementation applies the constraints-based layout and setting separatorStyle to UITableViewCellSeparatorStyleNone in this method will hide the separator for you.

- 854
- 9
- 13
-
doing this in viewDidLayoutSubviews (in my view controller) worked as well. – Ehren Dec 16 '15 at 16:53
-
If you are creating a table in a uiview you would want to set this in the DrawRect property of the view. – Travis Delly Mar 20 '18 at 18:01
From my investigations, it's not iOS 9 at fault, but Xcode 7.0 beta 4.
If I build the app using Xcode 7.0 beta 4, then the cell separators are shown even when set to None in Interface Builder. If I build the same code with Xcode 6.4 or 7.0 beta 3, the separators are not shown.
You can explicitly call this in your ViewController as a workaround:
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
(I guess ibtool
may be at fault)
-
In My case I am loading UITableview from the Code building with xcode 6.4 still I am getting this issue. – Piyush Hirpara Aug 04 '15 at 08:43
-
I get the problem in my current projet although I build a tableView and its properties programmatically. Therefore ibtool might be at fault, but he's not the only guilty actor :) – Jean Le Moignan Sep 17 '15 at 20:25
-
Perfect, when I update to final Xcode version I get fix the problem. – juancazalla Sep 18 '15 at 11:14
Solution from apple developer forum that worked for me:
You can remove the separators by set UITableViewCellSeparatorNone before every reloadData method (ios 9.1). I don't know why, but UITableView resets separatorStyle and separatorColor every tyme after the reloadData method is called.

- 2,087
- 18
- 18
-
Do you mean after or in each reloadData call? I had a similar experience where I had to add additional calls to set the separator and the background colors to get tables to appear correctly. – Fiid Sep 26 '15 at 15:33
Setting the separator style to .None
didn't work for me, so I used the edge insets as a hack workaround
self.tableView.separatorInset.left = UIScreen.mainScreen().bounds.width

- 81
- 3
-
YESSSSS. The only solution that also works when there are not enough cells to fill the tableview. – Jean Le Moignan Sep 18 '15 at 12:21
Below code worked for me,
override func layoutSubviews() {
super.layoutSubviews()
tableView.separatorStyle = .none
}

- 274
- 5
- 11
I had the same issue, worked fine on iOS 8 but show the separator in iOS9. I was setting the separator style to none already. The following resolved it for me
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
cell.preservesSuperviewLayoutMargins = NO;
}
cell.separatorInset = UIEdgeInsetsMake(0.f, 0.f, 0.f, cell.bounds.size.width);
if([cell respondsToSelector:@selector(setLayoutMargins:)]) {
cell.layoutMargins = UIEdgeInsetsZero;
}
This basically squash the separator using the inset.

- 914
- 7
- 13
This issue is quite annoying. And here is my solution:
override func didMoveToSuperview() {
if self.superview != nil {
self.tableView.separatorStyle = .None
}
}
Set the separatorStyle again when view is added to its superview.

- 397
- 3
- 13
myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
for Swift
myTableView.separatorStyle = UITableViewCellSeparatorStyle.None
in cellForRowAtIndexPath method will hide white lines in iOS 9 and later.

- 8,696
- 27
- 77
- 123