Vparab
Vparab

Reputation:

How do I remove the borders of a UITableView?

I have subclassed the UITableView control, and the style is grouped, but I do not need the cell separators. I tried setting my table view's separatorStyle to none, but it doesn't work. Can any one help me out?

Upvotes: 63

Views: 61155

Answers (6)

Noer Cholis
Noer Cholis

Reputation: 65

swift 4 use

myTableView.separatorStyle = UITableViewCellSeparatorStyle.none

Upvotes: 4

Gabriel
Gabriel

Reputation: 1215

To remove the border of a table view write this line:

self.myTableView.separatorColor = [UIColor clearColor];

If you want to remove both the border of a table view but the border between cells too, you have to write both lines:

self.myTableView.separatorColor = [UIColor clearColor];
self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;

Upvotes: 8

pradeep dhyani
pradeep dhyani

Reputation:

Use this

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

Upvotes: 63

Sam Soffes
Sam Soffes

Reputation: 14935

In a grouped table view, setting separatorStyle doesn't do anything. If you want to hide it, just do the following:

tableView.separatorColor = [UIColor clearColor];

Upvotes: 116

Akshay Shah
Akshay Shah

Reputation: 41

This did the trick for me:

[dayTableView setSeparatorColor:[UIColor whiteColor]]; //or your background color

Upvotes: 4

leonho
leonho

Reputation: 3543

How about setSeparatorColor to your cell's background color?

Upvotes: 2

Related Questions