Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove UITableView separator line

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?

like image 869
Evgeniy Kleban Avatar asked Oct 30 '16 18:10

Evgeniy Kleban


People also ask

How to remove separator line in UITableView in swift 4?

To hide UITableViewCell separator completely, simply set it's colour to UIColor. clearColor(). This will make the cell separator not visible.

How to remove separator in UITableView swift?

Add a Plain UIView to the Footer of the UITableView First, grab a plain UIView from the object browser, and drag it to the the footer position below all of your cell prototypes. It worked! The separator lines are gone.


1 Answers

Objective-C :

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; 

Swift:

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

like image 106
Jamshed Alam Avatar answered Sep 24 '22 12:09

Jamshed Alam