Remove UITableView separator line

IosObjective CUitableview

Ios Problem Overview

I want to remove the line between 2 views. The line that separates 2 UITableViewCells:

enter image description here

I declared table view as following:

self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
self.tableView.scrollEnabled = NO;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.estimatedRowHeight = 85.0;
self.tableView.rowHeight = UITableViewAutomaticDimension;

So i actually wrote - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

Why does it still exist?

Ios Solutions

Solution 1 - Ios

Objective-C :

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];


self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None

Swift 5.0 renamed it in :

self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none

Apply the line in viewDidLoad() method.

If you want to do it from nib file, set the tableView's Separator property to None

Solution 2 - Ios

For Swift 4:

tableView.separatorStyle = .none

Solution 3 - Ios

For Swift 5 :

     tableView.separatorStyle = UITableViewCell.SeparatorStyle.none

For Objective-C :

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

or you can use interface builder instead

enter image description here

For more information


Solution 4 - Ios

Hide tableView separators using UI

Here you select TableView 'Separator' property as 'None'.

Solution 5 - Ios

You can use the following code because it will not remove the line separators of the sections.:

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

    // Your code here //

    cell.separatorInset = UIEdgeInsetsMake(0.f, [UIScreen mainScreen].bounds.size.width, 0.f, 0.f);


Solution 6 - Ios

In Swift 4.2 you can conveniently use dot notation on a tableView's separatorStyle. Like so:

tableView.separatorStyle = .none

Solution 7 - Ios

My problem was when I add tableView trough code and I have separate func to show tableview and add it on mainView (slide from bottom) I needed to add this tableView.separatorStyle = .none in that func where tableView is added on mainView and constraint it.

Solution 8 - Ios

As @gonsee point out: "Setting separatorStyle seems to have no effect unless the table view is in the window's view hierarchy. If you have a table view on some UIView subclass"

You should set the seperatorStyle in viewDidAppear if you your table in UIView.

override func viewDidAppear(_ animated: Bool) {
        self.contentView.documentTableView.separatorStyle = .none

Solution 9 - Ios

you can archive these things in different ways

  1. you can also use this one line of code in viewDidLoad()

    override func viewDidLoad() {
       tableView.tableFooterView = UIView()

  1. You can do it on a storyboard

    select none

  1. set the code in viewDidLoad()

    override func viewDidLoad() {
       tableView.separatorStyle = .none

Solution 10 - Ios

add this line

tableView.separatorStyle = .none

Solution 11 - Ios

In viewDidLoad add tableView.separatorStyle = .none


override func viewDidLoad() {
    self.tableView.separatorStyle = .none // <---


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEvgeniy KlebanView Question on Stackoverflow
Solution 1 - IosJamshed AlamView Answer on Stackoverflow
Solution 2 - IosNirav PanchalView Answer on Stackoverflow
Solution 3 - Ioskishan savaniView Answer on Stackoverflow
Solution 4 - IosSumayya AnsariView Answer on Stackoverflow
Solution 5 - IosMohamed AdlyView Answer on Stackoverflow
Solution 6 - IosLeoView Answer on Stackoverflow
Solution 7 - IosclopexView Answer on Stackoverflow
Solution 8 - IosTiago MendesView Answer on Stackoverflow
Solution 9 - IosChandanView Answer on Stackoverflow
Solution 10 - IosUmer KhanView Answer on Stackoverflow
Solution 11 - IosMike ZrielView Answer on Stackoverflow