16

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?

Mike M
  • 4,447
  • 2
  • 33
  • 49

2 Answers2

77

I found the solution! Just set:

self.automaticallyAdjustsScrollViewInsets = NO;

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

samvermette
  • 39,555
  • 25
  • 108
  • 143
Mike M
  • 4,447
  • 2
  • 33
  • 49
0

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.

ConfusedDeer
  • 2,895
  • 7
  • 35
  • 60
  • What I need however is for the status bar to appear, as it does on iOS7... transparent, with views able to move behind it. What is happening is that the applicationFrame is actually set to {{0, 20},{748,1024}}. So it seems that the OS is accounting for that status bar and propagating the message to all views... How do I stop this? How do I tell it to NOT account for the status bar since it is transparent? – Mike M Sep 13 '13 at 11:54
  • A good rule to follow when you are coding is to never set anything regarding views to static location. Are you handling your view dynamically? – ConfusedDeer Sep 13 '13 at 12:13
  • This would be bad practice and not the best way to handle it, but can you simply substract the status bar height from the y coordinate of your view? I can't imagine how this would be happening unless you are statically setting the view to a location. Can you post any code? I'd like to be able to replicate this behavior. – ConfusedDeer Sep 13 '13 at 12:22
  • What do you mean by static? I have a "master" UIViewController with a UINavigationController inside of it and a UIScrollView as its root view. When I scroll this view, as soon as it stops... it offsets (jumps) the content by 20 pixels. The call stack points to a [UIScrollView _adjustContentOffsetIfNecessary]: function being called which adds 20 pixels to the contentOffset.y... – Mike M Sep 13 '13 at 12:38