views:

35

answers:

1

I'm using Apple's sample code for having separate Portrait and Landscape view controllers (presenting/dismissing a modal view controller from within the orientationChanged method). However, it creates a number of problems:

  1. The status bar doesn't rotate. If I manually setStatusBarOrientation, I get very strange behavior.
  2. The transition is very abrupt; I prefer the conventional smooth animation, especially because...
  3. 90% of the view changes, but there are two images which should look exactly the same (same size, same position, same orientation) in both the landscape and portrait modes.

My goal is a rotation transition more like the one in the Stocks app. How can I achieve this?

Thanks.

A: 

You could use core animation to do that. Fade out all elements that don't appear in the other view (by animating the opacity). Move and rotate the objects that are the same in each view. And finally fade in new objects in the second view. It might get rather complicated, depending on the complexity of your view. Have a look at these methods to find out where to implement the animations:

– willRotateToInterfaceOrientation:duration:
– willAnimateRotationToInterfaceOrientation:duration:
– willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:
– didAnimateFirstHalfOfRotationToInterfaceOrientation:
– willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:
hanno