Iphone 在iOS 6中调整大小
我是iOS开发的新手,我正在尝试实现一个可旋转和可调整大小的用户界面。我遇到的问题是在旋转时重新设置UI元素的位置。我甚至无法让下面的简单代码正常工作:Iphone 在iOS 6中调整大小,iphone,objective-c,ios6,Iphone,Objective C,Ios6,我是iOS开发的新手,我正在尝试实现一个可旋转和可调整大小的用户界面。我遇到的问题是在旋转时重新设置UI元素的位置。我甚至无法让下面的简单代码正常工作: - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAllButUpsideDown; } - (BOOL)shouldAutorotate { return YES; } - (void)willRotateToInter
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (BOOL)shouldAutorotate {
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
self.button.frame = CGRectMake(502.0, 207.0, 73.0, 44.0);
} else {
self.button.frame = CGRectMake(197.0, 69.0, 73.0, 44.0);
}
}
我已取消选择“自动调整子视图大小”选项;但是,按钮仍然在同一个位置结束。我已经记录了帧位置,它似乎有正确的坐标,但它肯定不会以这种方式结束。在实用程序inspect的第一个面板中。取消选中“使用自动布局”