Reputation: 3994
I'm developing a iOS app for iOS 7, the UI reflects this iOS version. But, I want to publish to others iOS's, like 6 or 5 too. So, I'll change my UI and the target iOS version. I have to save other project, with this modifications? How I'll publish the same app for differents iOS versions? Thanks and sorry for the stupid question, I didn't find anything about it.
Upvotes: 0
Views: 201
Reputation: 12123
In your app set the Deployment Target to iOS 5.
When it comes to UI have a read of this Apple Doc on iOS 7 transition guide.
Ones you have read that and understand it then you can move onto actually creating your UI.
When I have created my UI's based on iOS version I have a prepocessor macro set
#define IOS_VERSION() [[UIDevice currentDevice] systemVersion];
This is set in my ***-Prefix.pxh
file so I can access it throughout my app.
Then I can check this with a simple if statement
like so
if(IOS_VERSION => 7.0) {
// Do our iOS 7 stuff here
} else {
// Do everything else, you could add else if to check 6.0, 5.0 even 4.0
}
remember to wrapper some method calls in if statements
as well. Like:
if([object respondsToSelector:@selector(setTitle:forState)]) {
// object being whatever object you are wanting to work on UIButton, UILabel, UIView.
// The reason for this is some methods will be in iOS 7 or even 6 but not in iOS 5
// so if you called them methods you will received unrecognised selector excpetion.
}
You can also do somethings using interface build see the link I have provided for how to on interface builder.
Your design will differ based on iOS version. If you run on iOS 7 it will have the new flat UI look whilst if you build on other iOS it will have the old look. When moving over to the new look there wasn't many differences that we had to fix in our apps but we did have to fix some things. I would recommend building for either iOS 5 and 6 first and then 7 or the other way get it right in one before moving on.
Upvotes: 1
Reputation: 336
You should do this within a single app and it will run on whichever versions you've allowed. Start by setting your deployment target to the oldest version you want to support.
By using constraints or basing UI dimensions on known constants, you can accomplish most tasks that are OS version dependent.
A big issue to handle is the differences in how the status bar and transparent bars in iOS 7 are displayed. If you're using Interface Builder, you can use the View inspector on the right-side bar in XCode to set iOS6/7 Deltas that are applied depending on the version being run. You can also preview the differences in IB by selecting the root view of your xib and opening Identity inspector. Under Interface Builder Document, change "View as" to the OS version you want to see.
If all else fails, you can test for the OS version in code to write custom code for a version.
For example:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
//ios 6 code
} else {
//ios 7 code
}
Upvotes: 3
Reputation: 1229
You should have only one app supporting all of these.
In your XCode Project setting there will be a setting called deployment traget. which should be the Min OS version that your app supports. In your case it will be 5.0.
Coming to UI and other feature changes. You should be doing these at run time based the current OS version. Make use of [[UIDevice currentDevice] systemVersion]
You can load respective based on this version.
Upvotes: 0