I hope to rotate only one viewcontroller in a multi viewcontroller ( rootviewcontroller and viewcontroller 1, viewcontroller2,..)project开发者_Go百科.
Is it possible?
I noticed I have to make rootviewcontroller enable shouldAutorotateToInterfaceOrientation.
But the function willAnimateRotationToInterfaceOrientation in the viewcontroller that I prefer to rotate was not fired.
If you have sub controllers like :
RootViewController FirstViewController SecondViewController ...
When willAnimateRotationToInterfaceOrientation of RootViewController is called, you need to called yourself the same function of FirstViewController, SecondViewController etc.
For example
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[ FirstViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration ];
[ SecondViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration ];
}
By the way, yes you need to implement shouldAutorotateToInterfaceOrientation to say if YES or NO the controller should rotate.
Good Luck !
精彩评论