刚刚更新到 IOS SDK 6,现在我很困惑。试图找到解决方案,但我失败了。
- 在 xcode 中创建了一个新的“Single View iPad APP”(我有一个 iPad 3)
- 在 TARGETS->Summary 中禁用 Portrait & Upside-Down 界面方向
- 将模拟指标“方向”设置为“横向”
在视图控制器文件中添加了以下代码行:
- (BOOL)shouldAutorotate { return YES; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSLog(@"%@", NSStringFromCGRect(self.view.frame)); }
运行APP
我的输出是:2012-10-09 18:18:40.149 TestApp[6165:907] {{20, 0}, {748, 1024}} 有人知道为什么框架不是... {{0, 20} , {1024, 748}}如我所料?也许我错过了什么!
谢谢!