我解决了。我所做的是创建一个方法,从viewwillappear调用,它获取当前方向并更改为屏幕上的对象位置。
希望这能帮助别人。
- (void)manuallyMoveViewObjects{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
CGRect buttonFrame = CGRectMake(125.0, 223.0, 70.0, 50.0);
self.button.frame = buttonFrame;
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
CGRect gbuttonFrame = CGRectMake(205.0, 131.0, 70.0, 50.0);
self.button.frame = buttonFrame;
}
}