1

我已将部署目标设置为 iOS 4.3 并使用 xib 创建视图控制器。但 XCode 4.5 只为 iPhone 5(4 英寸)创建 xib。如何为 iPhone 4 创建单独的 xib?

4

3 回答 3

11

在视图属性检查器的“模拟指标”部分中,您可以选择 3,5" 或 4" 尺寸。选择 3,5",并使您的视图和子视图可调整大小,iOS 将自动缩放您的视图以适应 iPhone 5 的屏幕。

于 2012-09-25T11:54:07.777 回答
1

在您的 xib 中,选择控制器并在属性窗口中设置您想要保留视图的大小。

于 2012-09-25T11:57:30.000 回答
-1

我也在寻找相同问题的解决方案。我有一组视图,里面有图像视图,现有图像在 iPhone 5 中看起来很糟糕。不幸的是,我们需要支持所有 4.3+ iOS 版本,我别无选择,只能缩放图像视图为两个不同的 iPhone 使用单独的图像。这是我以前做的,

    float height = 480.0f;
    NSString *imageName = @"image640x480";
    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    {
        CGSize result = [[UIScreen mainScreen] bounds].size;
        height = result.height;
        imageName = @"image640x568";
    }
    // Set the height of your image view to the height calculated above and use the imageName variable to load the correct image
于 2012-10-16T21:22:48.060 回答