Search code examples
iphoneiosuiscrollviewrotationautoresize

Autoresize all UIScrollView subviews properly on orientation change


I have:

  • 1 paging scroll view at the bottom (like a panel) that is initially at 768x100 pixels, which is set up to stretch to 1024 when iPad rotates to landscape.
  • 2 subviews, each 768x100 pixels big; one at origin 0,0, and one at origin 768,0. In portrait, the user can swipe left and right to switch between these panels.

When I rotate to landscape, the subviews stay the same size even though autoresizing is correct. They also stay at the same position, which means the right hand pane now appears 256 pixels "in" from the right.

Is there no way to fix this using autoresizing? Do I have to adjust the subviews on rotation manually?


Solution

  • You can use autosizing on the interface builder.