当我在landscape模式下启动我的ViewController时(在调用viewDidLoad之后),我打印框架,它给了我纵向模式的帧大小.
这是一个bug有什么建议吗?
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"%@", NSStringFromCGRect(self.view.frame));
// Result is (0, 0 , 768, 1024)
}
Run Code Online (Sandbox Code Playgroud) 我的观点有错误的维度.我正在运行景观,但视图报告纵向尺寸"查看宽度= 768.000000高度= 1024.000000"任何想法如何解决?我玩过我试过的自转器
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft|| interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)
和
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
Run Code Online (Sandbox Code Playgroud)
它在视图上看起来很好,但尺寸确实与我的应用程序混乱.