Someone else asked a similar question previously, but I am interested in knowing whether the autorotate feature of the iPhone SDK will allow us to replace the rotation animation with another transition, such as a fade-in/fade-out. For a modal view, we can set the modalTransitionStyle but there is no such property for autorotate.
If I can’t leverage the built-in functionality, how else can I implement this functionality?
There’s the
willAnimateRotationToInterfaceOrientation:duration:method, from the docs:I guess you can modify it from here, and before and after with
– willRotateToInterfaceOrientation:duration:and– didRotateFromInterfaceOrientation:.This seems inefficient and sub-par to me, as it does not actually replace the transition at all.
I would make a category on UIView, that includes methods such as –
willRotateUsingTransition:and pass a parameter that will tell it to fade, then set the view’s alpha to zero. In each subclass override this to include any subviews that need their alpha changed, if that is applicable. Call this method when the views are about to be rotated (with the methods above) and then a clean-up method that restore the alphas when they will appear again.Edit: Docs Docs Docs. A quick look, again, reveals this method:
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration, which I thought to be deprecated. As part of the discussion it has the text from the second paragraph I posted from the docs earlier.