Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}
Related
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.
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)
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
Use this code:
if([[[UIDevice currentDevice] systemVersion] isEqualToString: #"7.0"])
{
//do stuff
}
else
{
// code here
}
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.
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
}
}
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.
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
}
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.
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.
Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}
Can I set two different xibs for iOS6 and iOS7?
I can't make the same changes to the same xib file for both iOS, and I can't set everything in the code.
thanks
Yes, you can just use [[UIDevice currentDevice] systemVersion] as stated in this question's accepted answer: How to check iOS version?
Get the version and conditionally load the correct XIB accordingly.
The suggested Apple method to check the version on iOS is this one, it is also reported in the ios7 transitioning guide:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
As you can see here
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How do I support the taller iPhone 5 screen size?
How to make my app 4inch-ready? My app in iOS6GM simulator looks not 4inch-sized.
Is there any option in xcode to use all 4 inches?
Some users have reported that it was fixed after adding the startup image Default-568h#2x.png (see below).
For updating to iPhone5 I did the following:
Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method of UIViewController is deprecated. In its place, you should use the supportedInterfaceOrientationsForWindow: and shouldAutorotate methods. Thus, I added these new methods (and kept the old for iOS 5 compatibility):
-(BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Then I fixed the autolayout for views that needed it.
Copied images from the simulator for startup view and views for the
iTunes store into PhotoShop and exported them as png files.
The name of the default image is: Default-568h#2x.png the size is
640 x 1136 and the screen size 320 x 568.
I have dropped backward compatibility for iOS 4. The reason is that
this new Xcode does not support armv6 code any more. Thus, all
devices that I am able to support now (running armv7) can be upgraded
to iOS 5.
That was all but just remember to test the autorotation in iOS 5 and iOS 6 because of the changes in rotation.
Before iPhone 5 release, I just use
#define kViewHeight 460.f // or 480.f if you don't have a status bar
#define kViewWidth 320.f
But now, I would like to use
#define kViewHeight CGRectGetHeight([UIScreen mainScreen].applicationFrame)
#define kViewWidth CGRectGetWidth([UIScreen mainScreen].applicationFrame)
instead.
But I'm not sure whether it is a good solution. As you see, you would dispatch CGRectGetHeight([UIScreen mainScreen].applicationFrame) every where you use kViewHeight. I've tried to use
extern float kViewHeight; // in .h
float kViewHeight = CGRectGetHeight([UIScreen mainScreen].applicationFrame) // in .m
but failed with a compile error.
Though it works well, I think there must be a better workaround. ;)