TIMEX TIMEX - 5 months ago 22x
Swift Question

How can a cell's UIImage cover the UITableView separator?

I subclassed UITableViewCell. Then, in my storyboard, I added an image to the superview. The image has constraints of:

left: 0
bottom: -5
width: 10
height: 10

The reason I put -5 as the bottom constraint is because I want it to cover the separator line.

However, in this solution, the image goes underneath the line instead of over it.


Since the separator view and cell's content view are at the same level in the view hierarchy you could use bringSubviewToFront to display the content view over the separator, however this might cover it if you use a background color for the contentView. All you have to do is set


in cellForRowAtIndexPath. If this does not suit your needs you can always implement your own custom cell with a custom separator.