Evgeniy Kleban Evgeniy Kleban - 1 month ago 14
iOS Question

Remove UITableView separator line

I want to remove following line, between 2 views. That line separate 2 UITableViewCell's:

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 that still exist?

Answer

Objective-C :

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

Swift:

self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None

Apply the line in viewDidLoad() method.

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