0

When I load my scrollview initially it works fine. However when I click a menu button to display a view modally and then dismiss the view it shifts the entire scrollview to the left. What used to be the start of the scrollview is now off the screen to the left and the end of the scrollview has some added white space.

I've check the contentoffset before and after the seque and it stays the same it just appears that the contents of the uiscrollview have shifted entirely to the left.

I'm using autolayout to create my scrollview. In my scrollview I have a container view which holds several views in it. the container view defines the size of the scrollview by how many subviews I put into the container view.

Leavign ScrollView Subviews UIView: 0x1f088040; frame = (0 0; 1597.5 192.5); layer = CALayer: 0x1f0552c0

View Did Appear ScrollView Subviews UIView: 0x1f088040; frame = (-480 0; 1597.5 192.5); layer = CALayer: 0x1f0552c0

Even more weird is when I set the container view back to it's orginal size it doesn't stay there as soon as I start scrolling it has the correct initial value but then resets back to the wrong value.

In prepareForSegue:

Leaving ScrollView Subviews UIView: 0x1e06a3a0; frame = (0 0; 1597.5 192.5); layer = CALayer: 0x1e03a290

In ViewDidAppear before I set it back to 0 0

View Did Appear ScrollView Subviews UIView: 0x1e06a3a0; frame = (-480 0; 1597.5 192.5); layer = CALayer: 0x1e03a290

In View Did Scroll

view Did Scroll ScrollView Subiews UIView: 0x1e06a3a0; frame = (0 0; 1597.5 192.5); layer = CALayer: 0x1e03a290

view Did Scroll ScrollView Subviews UIView: 0x1e06a3a0; frame = (-480 0; 1597.5 192.5); layer = CALayer: 0x1e03a290

view Did Scroll ScrollView Subviews UIView: 0x1e06a3a0; frame = (-480 0; 1597.5 192.5); layer = CALayer: 0x1e03a290

view Did Scroll ScrollView Subviews UIView: 0x1e06a3a0; frame = (-480 0; 1597.5 192.5); layer = CALayer: 0x1e03a290

It always seems to be offsets of multiples of 160

Ben Coffman
  • 1,750
  • 1
  • 18
  • 26
  • Are you doing anything in code to set the frame of the scroll view? This sounds like it could be an auto layout problem. – rdelmar Feb 18 '13 at 18:50
  • I think this is the issue. -- From the documentation of UIViewController's presentViewController: method: This method sets the presentedViewController property to the specified view controller, resizes that view controller’s view and then adds the view to the view hierarchy. The view is animated onscreen according to the transition style specified in the modalTransitionStyle property of the presented view controller. – Ben Coffman Feb 18 '13 at 19:19
  • What container view? You haven't mentioned any container view in your question. – rdelmar Feb 18 '13 at 19:24
  • almost identical to this question. http://stackoverflow.com/questions/12509265/ios-autolayout-issue-with-scrollview – Ben Coffman Feb 18 '13 at 19:58

0 Answers0