【发布时间】:2013-05-15 05:19:57
【问题描述】:
我正在使用情节提要开发 iPad 横向应用程序。我已经完成了以下步骤。我的应用是在模拟器上以横向模式打开屏幕。但帧错误。
- 来自 xcode 的故事板示例应用模板。
- 只允许 info-plist 文件中的横向显示
- 故事板 -> UIViewController -> 模拟矩阵 -> 将方向更改为横向
-
在view controller.m中实现下面的方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)); }
现在,当我获取帧的 NSLog 并设置边界时,它会显示纵向帧。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"bounds ::%@",NSStringFromCGRect(self.view.bounds));
NSLog(@"frame ::%@",NSStringFromCGRect(self.view.frame));
}
结果日志:
bounds ::{{0, 0}, {748, 1024}}
frame ::{{20, 0}, {748, 1024}}
我错过了什么吗?
【问题讨论】:
标签: ios objective-c