iOS - UIViewcontroller detect rotation?
I am using willRotateToInterfaceOrientation to detect rotation and move items according to the orientation.
The problem is that whe开发者_开发技巧n the page first loads this method doesn't get called so it doesn't try to move the objects to the correct location?
What is the solution?
You need to setup the interface according to the orientation
if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait) {
// do something
} else if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight) {
// do something else
}
And repeat that for al the different device orientations
I manually detected the UIInterfaceOrientation from my UIApplication, and I manually called willAnimateRotationToInterfaceOrientation on viewDidAppear
加载中,请稍侯......
精彩评论