Iphone – iOS7 UIScrollView show offset content below status bar

ios7iphonestatusuiscrollview

I'm developing my app to work with iOS7.
I have a UINavigationController I'm pushing a UIViewController that has a ScrollView inside it. Inside the scrollView I have a tableView.
Is it possible to achieve that when I scroll the tableView inside the scrollView the list will appear behind that Status bar. Same why it would be if I had a UINavigationController and a UIViewController with a tableView in it.

So this it the hierarchy :

UINavigationController -> UIViewController -> UIScrollView -> UITableView .

and I want that when a user scroll the table,the cells in the top will be visible under the status bar.

If there is no UIScrollView it happens automatically in iOS7.

Thanks.

Best Answer

Just set automaticallyAdjustsScrollViewInsets to NO in the viewController init method.

In Storyboard, you can switch the property directly in the property panel when the UIViewController is selected.

If you use xib, just set it like this:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self.automaticallyAdjustsScrollViewInsets = NO;
}

Note: this is right since iOS7 and still in iOS8.