I am using willRotateToInterfaceOrientation
to detect rotation and move items according to the orientation.
The problem is that when 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
我手动检测UIInterfaceOrientation
从我UIApplication
,我叫手动willAnimateRotationToInterfaceOrientation
上viewDidAppear
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.