UITableView - lines between cells

I have a UITableView that has cells for which, for example, let only the top two be filled. For the remaining cells, going down the list, there are still dividing lines.

Is there a way to turn off lines where there are empty cells, but save them to separate cells containing information?

+6
source share
3 answers

There is no built-in support for this.

You can disable cells in the table view with:

 self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 

And then draw the dividing lines in your UITableViewCell subclasses that you use for the rows.

+26
source

Another simple hack is to add this UITableViewControllers viewDidLoad method:

  self.tableView.tableFooterView = [UIView new]; 
+1
source

Another way is to simply write a line in viewdidLoad

 self.myTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; 
0
source

Source: https://habr.com/ru/post/896126/


All Articles