Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TableView Cell Separator Line Not Extending Across the Entire Cell

I am working on a new project and have used a storyboard for the UI. All of my tableViews have an issue with the line separator. The picture below shows two lines. The first is a blue one which was set in the attributes inspector. The second one is black and was added with an imageView that I placed in the cell. The line does extend to the right side of the cell but not the left. Any ideas?

Blue separator line does not extend all the way to the left side of the cell.

like image 260
jonthornham Avatar asked Feb 22 '15 06:02

jonthornham


2 Answers

first set table view
1.set separatorInset of tableview instance to UIEdgeInsetsMake(0, 0, 0, 0)
second set cell
1.set preservesSuperviewLayoutMargins of cell (instance) to NO
2.set layoutMargins of cell to UIEdgeInsetsZero
3.saet separatorInset of cell to UIEdgeInsetsZero

Hope to help you

like image 174
Buer Avatar answered Nov 18 '22 19:11

Buer


You have to make sure your cell property called preservesSuperviewLayoutMargins is set to false (default)

cell.preservesSuperviewLayoutMargins = false

Then you just have to set your cell layoutMargins to zero

cell.layoutMargins = .zero

You need also to select you cell separator, select custom and change left value from 15 to 0

enter image description here

like image 2
Leo Dabus Avatar answered Nov 18 '22 18:11

Leo Dabus