1

I am using Xcode 5. I want to build an app with UI compatible with both IOS 6 as well IOS 7. Can anyone help me with this. App should be compatible with iPhone (3gs), iPhone retina 3.5 and iPhone retina 4.

UI gets distorted when i watch it on iPhone (3GS) having IOS 6.

I have tried enabling Auto layout, But still the problem persists for some of the screens.

TechFanatic
  • 1,218
  • 4
  • 13
  • 31
  • 2
    Vote to close as **Demonstrates a minimal understanding** also it's not hard to google and find https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/ a little bit of research goes a long way have a read of http://meta.stackexchange.com/questions/182266/how-much-research-effort-is-expected-of-stack-overflow-users/182380#182380 – Popeye Oct 21 '13 at 11:28

2 Answers2

2

1: If you are using UINavigationController and your navigation bar is visible then this works

float systemVersion=[[[UIDevice currentDevice]systemVersion]floatValue];

if(systemVersion >=7.0f)
{

self.edgesForExtendedLayout=UIRectEdgeNone;

 }

OR You can also set from stoyboard

enter image description here

2: Another solution is . You can use IOS 6/7 Deltas

i) take new view and setting its Y postion is 20

ii) move all control into this view

iii)setting new view Detas Y Property is -20

Now you view hirerachy is look like as

enter image description here

You can see in follwing image how to set Deltas property

enter image description here

Kalpesh
  • 5,336
  • 26
  • 41
0

There are several macros which are helpful in this case

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#define APP_VERSION_GREATER_THAN_OR_EQUAL_TO(v)     ([[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] compare:v options:NSNumericSearch] != NSOrderedAscending)

To see is your iOS version is greater than iOS7:

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
 // iOS 7 specific instruction
}

However is this IF-ELSE is still long, you can do something like this

#define IS_IOS_7 SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")

and then

if (IS_IOS_7) {
  // instruction...
}
h4cky
  • 899
  • 1
  • 13
  • 33