iOS7 Content Offset by 20 pixels for non existent Status Bars

7.6k views Asked by At

I have a strange behaviour with my UIViews as I'm migrating to iOS7. It seems that they are sent a message to shrink by 20 pixels. I have removed the status bar from all my XIB files and explicitly set it to hidden in the application delegate. My UINavigationController seem to be sent a message:

_computeAndApplyScrollContentInsetDeltaForViewController

which in turn sends messages to my scroll views

_adjustContentOffsetIfNecessary

which set their offset to -20 pixels... This should not really happen as there is no reason for that function to adjust anything by that amount.

Does anyone have an idea of how to fix this?

2

There are 2 answers

1
Mike M On BEST ANSWER

I found the solution! Just set:

self.automaticallyAdjustsScrollViewInsets = NO;

on the view controller that has the scroll view as a view...

4
ConfusedDeer On

20 pixels (or maybe points) that sounds like its the status bar when its NOT receiving a phone call (I believe 40 when receiving a call). Not sure if this will fix your problem, but I had an issue where in iOS7 my status bar was not being hidden. I hid it programmatically and it still displayed in iOS7, but when ran in iOS6 the status bar would hide appropriately. You have to go to the plist and add the following: 'view controller-based status bar appearance' and set to NO.