Ios UITableView & # 8594; UITableViewCellSeparatorStyleNone leaves a row with one pixel height

I want to omit the dividing line between the two cells of the table. But instead of a separator, I get a dividing line with a height of 1 pixel, which simply remains empty or is best transparent.

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

+7
source share
3 answers

Well, I found the answer for mine and shared it simply because it helps others.

I installed all my cells procedurally, so I disabled the delimiter through

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

next I set the separator style through

 m_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 

although I must admit that I did nothing, and it could be a remake.

For me, I found that cellForRowAtIndexPath was called to set up the cell, and I had to expand the background image by 1 pixel in height to get rid of the line (I use a stretch image for this too, which can also give itself to a fancy +1 request). I'm not a fan of arbiter +1, but that seemed to do the trick ...

 frameBackground.size.height += 1; 

therefore, without approving +1, the above steps worked for my list and now no longer have a separator.

+4
source

I found that my header was set to 1, removing this fixed my problem (I had an extra 1 pixel in the odd cell separator). I changed to 0 and life seems better

 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 0; } 
0
source

I could not get rid of the separator, so I finally decided to write my own table view on top of the UIScrollView. And the "separator" was still there! It turns out there is an error in UILabel that can sometimes cause it to draw a thin line along the top edge if you set the background color. The fix is ​​to set the background on the layer: label.layer.backgroundColor = color.CGColor;

0
source

All Articles