Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios UITableView -> UITableViewCellSeparatorStyleNone leaves a line of one pixel height blank

I want to omit the separation line between two tableview cells. But instead of no separator I get a separation line of height 1 pixel that is simply left blank or better said completly transparent.

How can I tell the uitableview how to attach the next cell directly to the cell above (without any gap)?

like image 359
toom Avatar asked May 15 '12 16:05

toom


1 Answers

Ok, found the answer for mine and sharing it just incase it helps others.

I set all my cells up procedurally so I turned off the separator via

m_tableView setSeparatorColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f]]

next I set the separator style via

m_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

although I have to admit that didn't seem to do anything and this might be a redherring.

For me I found that cellForRowAtIndexPath was called to configure the cell and I had to extend my background image by 1 pixel in height to get rid of the line (I am using a stretchable image for this too which might also be lending itself to the bizarre +1 requirement). I'm not a fan of arbitary +1's but this seemed to do the trick...

frameBackground.size.height += 1;

so whilst not endorsing a +1 the above steps have worked for my listview and now no longer have a separator.

like image 170
sradforth Avatar answered Oct 23 '22 02:10

sradforth