Search code examples
iosiphoneobjective-cscreen-size

Different versions of app for different devices


I am developing an iOS app for 4-inch screen. That means my app looks terrible on 3.5-inch screen because of images. If I published it in App Store, would it be possible to download this application for 3.5-inch iphone users? If I want to make a version of my app for 3.5-inch screens, should I just make two different projects?


Solution

  • No, you can't stop people with a 3.5'' device downloading, however:

    You can support both 4'' and 3.5'' devices with the same application.

    You need to programmatically check which device you're currently running on and then layout your UI appropriately.

    As a simple example, you can check if you're on a 4'' device (iPhone 5, 5C, 5s) with the below code snippet:

    #define isFourInch  ([[UIScreen mainScreen] bounds].size.height == 568)?TRUE:FALSE
    
    
     if (isFourInch)
     {
           //4'' screen detected
     }
     else
     {
    
           //3.5'' screen detected
     }
    

    Because iOS 7 supports devices with 3.5" screens, you can't use the only-support-iOS-x technique.

    Also, there isn't a setting in Xcode or a key for UIRequiredDeviceCapabilities which allows you to make the app 4-inch only.