如何使用Xocde 4.5为iPhone 4和iPhone 5创buildxib

我已经将部署目标设置为iOS 4.3并使用xib创buildviewcontroller。 但XCode 4.5只为iPhone 5(4英寸)创buildxib。 我怎样才能为iPhone 4创build一个独立的xib?

在视图属性检查器的“模拟度量标准”部分,您可以select3,5“或4”大小。 select3,5“,并使您的意见和子视图可resize,iOS会自动缩放您的视图,以适应iPhone 5的屏幕。

在你的xib中,select控制器,在属性窗口中设置你想保留的视图的大小。

我也在为同样的问题寻找解决scheme。 我有一个看法,那些在他们的图像视图和现有的图像看起来非常糟糕的iPhone 5。不幸的是,我们需要支持所有的4.3以上的iOS版本,我没有别的select,但也扩大图像视图为两个不同的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