Change GUI when selecting iOS 6 in Xcode 5

2019-09-19 12:02发布

问题:

When I am using Xcode 5 and I set the deployment target as 7.0, the application runs perfectly with both 4-inch and 3.5-inch displays.

I have downloaded the iOS 6 SDK already.

When I change the base SDK to iOS 6 and set the deployment target as iOS 6.1 my GUI is affected in a way that changes every image, navigation bar, images and all other controls.

I am not using autolayout and have two .xib files for one UIViewController in each class.

So, how can I get fix this?

Thanks in advance.

回答1:

When you compile with the iOS 6 SDK , you application is created with the iOS6 images, views, keyboards, etc...

You can't use iOS7 views if you are compiling for iOS6, you need to compile for iOS7, even thought your app is iOS6 compatible (setting the deployment target to iOS6)



回答2:

Long story short - you can't use iOS 7 GUI in your iOS 6 app. If you want you can just create your custom GUI and use it in your app. But some elements will be different, you better read this guide:

  • Apple docs

Also if you build you app for different versions of iOS you better use auto layout:

  • Ray Wenderlich - Auto Layout Tutorial in iOS 7: Part 1
  • Ray Wenderlich - Auto Layout Tutorial in iOS 6: Part 1

Some issues of transition from iOS 6 to iOS 7:

  • Status bar and navigation bar issue in IOS7


回答3:

Use this code:

if([[[UIDevice currentDevice] systemVersion] isEqualToString: @"7.0"])
{    
    //do stuff 
}
else
{ 
  // code here
}


回答4:

When compiling for iOS 7 you are using iOS 7 specific GUI elements (that differs a lot from iOS 6). Phones that are still on iOS 6 (about 16%) will however see the iOS 6 GUI elements for obvious reasons, even if you compile it for iOS 7.

There is really no way to resolve this, you should simply develop for iOS 7 and let iOS 6 users still have iOS 6 GUI elements.



回答5:

If your application is working fine in iOS 7 and you need to run it iOS 6 then you need to manage the application using this method:

if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending){
    //CGRect gridFrame;
    if ([[UIScreen mainScreen] bounds].size.height == 568) {
       // Do nothing if already managed
    }else{
       // Do nothing if already managed
    }
}else{
    //CGRect gridFrame for ios6;
    if ([[UIScree`enter code here`n mainScreen] bounds].size.height == 568) {
        //Manage frame here 
    }else{
       //Manage frame here 
    }
}


标签: ios iphone xcode