您正确设置了 plist。现在确保所有视图控制器都具有以下内容:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation==UIInterfaceOrientationLandscapeRight) ? YES : NO;
}
没有它的子视图可能会把事情搞砸。
此外,如果您有 UINavigationController 或类似的东西,您需要对其进行子类化并实现 shouldAutorotateToInterfaceOrientation 因为它本身就很愚蠢,并且会默认为纵向并破坏事物。
然后对于 viewdidload
- (void)viewDidLoad {
[super viewDidLoad];
CGRect rect = [[UIScreen mainScreen] bounds];
rect.size.height = 320;
rect.size.width = 480;
rect.origin.x = 0;
rect.origin.y = 0;
glView = [[EAGLView alloc] initWithFrame:rect pixelFormat:GL_RGB565_OES depthFormat:GL_DEPTH_COMPONENT16_OES preserveBackbuffer:NO];
[self.view addSubview: glView];
[glView addSubview: minimapView];
//etc...
}