Remove border in each table cell in swift

May Phyu picture May Phyu · May 9, 2016 · Viewed 15k times · Source

I would like to remove border bottom line of each Question table rows. Another thing is that I would like to remove the left padding space in each row. How to implement it in swift iOS 9.0 .

enter image description here

Answer

Jigar Tarsariya picture Jigar Tarsariya · May 9, 2016

You can remove bottom border by writing this below line in viewdidLoad,

self.tblMyTable.separatorStyle = UITableViewCellSeparatorStyle.None

And Remove left padding by writing this in cellForRow,

cell.separatorInset = UIEdgeInsetsZero
cell.layoutMargins = UIEdgeInsetsZero 

Update for Swift 3.0:

cell?.separatorInset = UIEdgeInsets.zero
cell?.layoutMargins = UIEdgeInsets.zero