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?
Asked
Active
Viewed 6.1k times
6 Answers
115
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];

Sam Soffes
- 14,831
- 9
- 76
- 80
-
awesome, so maybe I can animate a little rainbow colored effect from the bottom to the top, to the _enjoyment_ of the user ;) – JeroenEijkhof May 26 '11 at 03:03
-
1+1, works like charm. @seperatorStyle property doesn't works on group table view. – HelmiB Jun 09 '11 at 06:02
-
Hi Sam, I tried setting group table's color but it does nothing for me! I mean [groupedTableView setSeparatorColor:[UIColor whiteColor]]; statement doesn't set separator color to white. The separator color always appears as default light brown color but it works fine for plain table! Can you help me what could be wrong? – Paresh Masani Aug 22 '11 at 13:46
-
1I have just noticed that the separator color appears when I select the cell but otherwise it's brown! – Paresh Masani Aug 23 '11 at 10:36
-
This works great on a plain table view, but it doesn't work on grouped. A bug? – TigerCoding Feb 21 '12 at 14:12
62
Use this
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

Navnath Godse
- 2,233
- 2
- 23
- 32
-
7This doesn't work for any tableView using the grouped style (per question). – Steven Fisher May 25 '11 at 23:17
-
6I find that for a grouped tableview this separatorStyle setting can remove an annoying white border on the bottom of the group when separatorColor clearColor is also used (in iOS 5; didn't have the problem in < 5) – ransomweaver Oct 08 '11 at 13:54
8
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;

Navnath Godse
- 2,233
- 2
- 23
- 32

Gabriel
- 1,215
- 13
- 16
4
This did the trick for me:
[dayTableView setSeparatorColor:[UIColor whiteColor]]; //or your background color

sth
- 222,467
- 53
- 283
- 367

Akshay Shah
- 41
- 1
-
Akshay, this doesn't work for me. For me group table's separator color always appear default brown no matter what color I set but it works fine for plain table! Do you have any idea what could be wrong? – Paresh Masani Aug 22 '11 at 13:47
2
How about setSeparatorColor to your cell's background color?

leonho
- 3,563
- 2
- 21
- 16
-
I tried tht but there is no property called seperatorColor . i have subclassed the cell also , so in the cell's init i have done foll : self.separatorStyle = UITableViewCellSeparatorStyleNone; but its gives compile time error :( – Nov 13 '08 at 09:54
-
-
1i have used the proper spelling , But these properties are avaiable only for the table view .I want to set the peoperty for the UiTableViewCell obj. As they have mentioned in the reference that the cell separator properties need to be set . I donno y cell and table prop has 2 b set. :( – Nov 14 '08 at 05:25