Is there a way to set a UITableView's contentInset through Storyboard?

3254523 picture 3254523 · Aug 8, 2014 · Viewed 24.9k times · Source
self.tableView.contentInset = UIEdgeInsetsMake(232, 0, 232, 0)

is there a way of setting this in Storyboard?

Answer

Lars Blumberg picture Lars Blumberg · Sep 15, 2015

The content inset option seems to be gone from the attribute inspector since Xcode 6. But if you don't want to define contentInset in code as it is user interface related, there's still an option left:

Select your UITableView and open the Identity Inspector (Alt+Cmd+3) and click the plus button to add an user defined runtime attribute. Select Rect as its type and contentInset as its key path.

See example here that changes the top inset. 50 appears to be stored as the x value but strangely it changes the top inset.

Reference: {{top, left}, {bottom, right}}

Setting content inset as user defined attributed