load UIView in the correct orientation without waiting for it to autorotate - iPad
This is probably a really dumb question, but I can't seem to figure it out. My iPad application supports landscape and portrait orientations -so far so good. but when I'm in landscape mode, if I switch from one view to another there's a little rotation animation, even though I didn't rotate the device. It is as if the UIView I'm loading tries to load first in portrait mode, but then it realizes it is in landscape mode and autorotates. Is there any way I can get r开发者_Python百科id of this autorotation animation? perhaps it has something to do with the code I'm using to make the switch:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:window cache:YES];
[self.window addSubview:aNewView];
[currentView removeFromSuperview];
[UIView commitAnimations];
Thanks for your help!
It was a dumb question. You simply have to load the correct orientation in a method you call in your viewDidLoad, instead of doing it on the willAnimateRotationToInterfaceOrientation.
精彩评论