How can I create xibs for both iPhone 4 and iPhone 5 using Xcode 4.5

后端 未结 3 1635
走了就别回头了
走了就别回头了 2021-01-07 09:24

I have set deployment target as iOS 4.3 and creating viewcontroller with xib. But XCode 4.5 is creating xib for iPhone 5 (4 inch) only. How can I create a seperate xib for i

3条回答
  •  盖世英雄少女心
    2021-01-07 09:50

    I was also looking for a solution for the same issue. I have a set of views those who have image views inside them and the existing images look very bad in the iPhone 5. Unfortunately, we need to support all 4.3+ iOS versions and I have no other option but to scale the image view as well as use separate images for two different iPhones. This is what I used to do,

        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
    

提交回复
热议问题