How to set UITableviewCell separator left Margin to 0 in iOS 9?

how can i set left margin of UITableview separator to 0 in ios9?. in ios 8 and lower its ok but in ios 9 its not working.

i used

tableView.cellLayoutMarginsFollowReadableWidth = false

But still its not working!


please help me.

Accepted Reply

It seems appearance doesn't work but if you set the UITableViewCell's layoutMargins directly it works.

Replies

I have the same Problem... can anybody give a hint?

Set tableView's separator inset and cell's layoutMargins to zero.

i used these codes, but its not working in ios 9


// iOS 7

UITableView.appearance().separatorStyle = .SingleLine

UITableView.appearance().separatorInset = UIEdgeInsetsZero

UITableViewCell.appearance().separatorInset = UIEdgeInsetsZero

// iOS 8

if #available(iOS 8.0, *)

{

UITableView.appearance().layoutMargins = UIEdgeInsetsZero

UITableViewCell.appearance().layoutMargins = UIEdgeInsetsZero

UITableViewCell.appearance().preservesSuperviewLayoutMargins = false

}

// iOS 9

if #available(iOS 9.0, *)

{

UITableView.appearance().cellLayoutMarginsFollowReadableWidth = false

}

It seems appearance doesn't work but if you set the UITableViewCell's layoutMargins directly it works.

Thanks 🙂