Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make UITableView cells in iOS 7 not have a line break in the separator?

I noticed that in iOS 7, UITableViewCells have a line break in the separator of the cell that iOS 6 does not have. Is there a way to get rid of this line break? Changing the separator to none and then making UIViews with the color of the separator still causes the white separator to occur regardless.

like image 819
Anthony Glyadchenko Avatar asked Aug 21 '13 18:08

Anthony Glyadchenko


People also ask

How do I hide cell separator in Swift?

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

How do you make a tableView cell Unselectable?

To completely prevent selection of the UITableViewCell , have your UITableViewDelegate implement tableView:willSelectRowAtIndexPath: . From that method you can return nil if you do not want the row to be selected. This prevents the row from being selected and tableView:didSelectRowAtIndexPath: from being called.


1 Answers

For iOS7:

if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {     [self.tableView setSeparatorInset:UIEdgeInsetsZero]; } 

For iOS8:

First configure your table view as follows:

if ([self.tableView respondsToSelector:@selector(layoutMargins)]) {     self.tableView.layoutMargins = UIEdgeInsetsZero; } 

Then in your cellForRowAtIndexPath: method, configure the cell as follows:

if ([cell respondsToSelector:@selector(layoutMargins)]) {     cell.layoutMargins = UIEdgeInsetsZero; } 

Note: Include both layoutMargins and separatorInset, to support both iOS versions

like image 71
Luis E. Prado Avatar answered Sep 28 '22 00:09

Luis E. Prado