0

我有一个风景 ViewConroller,

我创建并添加它:

gameVC = [[GameViewController alloc] initWithNibName:@"GameViewController" 
                                                                  bundle:nil];
[viewController.view removeFromSuperview];
[self.window addSubview:gameVC.view];

GameViewController我有方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if(interfaceOrientation == UIInterfaceOrientationLandscapeRight){
        return YES;
    }else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
        return YES;
    }else {
        return NO;
    }
}

现在的问题是,当我在 iphone 3(或其他非视网膜屏幕)上运行应用程序时,屏幕看起来像 xib 文件,而当我在 iphone 4(或其他视网膜屏幕)上运行它时,UIViewController 上的 UIViews 在左侧 10-20 个像素。

知道如何解决吗?

4

1 回答 1

0

在 Interface Builder 的 Size Inspector 中为 GameViewController.xib 检查视图的自动调整大小掩码。此外,父视图(有问题的视图)的精确尺寸可能是错误的尺寸(相差几个像素)。

于 2012-04-22T20:47:19.763 回答