UITableView is starting with an offset in iOS 7

user798719 picture user798719 · Aug 22, 2013 · Viewed 98.6k times · Source

I have dragged a plain jane UITableView onto a UIViewController in iOS 7.

Now there is an vertical offset of space before the first cell starts. How do I get rid of it? I want the first line to be much closer to the top edge of where the UITableView actually starts. I did not ask for the large offset did I?

enter image description here

Any ideas?

Answer

xudre picture xudre · Sep 24, 2013

The new iOS 7 implementation of UIViewController has a new set of options that allows the developer to choose if the system will automatically add insets for UIScrollView, UITableView and derivations.

To disable this behaviour uncheck these boxes for all your wanted UIViewControllers in InterfaceBuilder, on UIViewController selected object inspector:

View Controller Inspector

For more details:

  1. Submit your iOS 7 apps today.
  2. iOS 7 UI Transition Guide > Appearance and Behavior