0

I am having a UITableViewController subclass and want to add left and right edge margins to the tableview. I tried below but that is not helping. I do not want to change the view hierarchy by moving tableview as subview to a UIView.

self.tableView.contentInset = UIEdgeInsetsMake(0.0, 20.0, 0.0, 20.0)

What can be done in this case?

Abhinav
  • 37,684
  • 43
  • 191
  • 309

1 Answers1

0

After some testing myself I think your best options is to customise your TableViewCells and add a margin property there. By doing so, you can easily change the margin dynamically or set it to 0 if you want to remove it completely.

For inspiration check out the answer to this post by @ezcoding. Hope this helps.

Community
  • 1
  • 1
Aerows
  • 760
  • 6
  • 22