IOS 6应用程序升级到IOS 7

我想升级我的应用程序从IOS 6到IOS 7 …我的应用程序是通用的,并升级到IOS 7我已经创build了两个不同的XIB文件一个IOS 6和一个IOS 7 ..我已完成升级,但问题是我的应用程序运行在IOS 7 4英寸模拟器完美…但是当我运行我的应用程序在IOS 7 3.5模拟器或设备,然后其graphics和数据不显示在其正确的地方…有时它崩溃。 ..

i have also used Macro Below.. #define iPhone5 @"iPhone 5" #define iPhone @"iPhone" #define iPad @"iPad" #define IS_IPHONE ([[[UIDevice currentDevice]model]hasPrefix:@"iPhone"]) #define IS_IPOD ([[[UIDevice currentDevice]model]hasPrefix:@"iPod touch"]) #define IS_HEIGHT_GET_568 [[UIScreen mainScreen]bounds].size.height==568.0f #define IS_IPHONE_5 (IS_HEIGHT_GET_568) #define IS_IPAD ([[[UIDevice currentDevice]model]hasPrefix:@"iPad"]) 

我build议你看看Autolayout解决设备屏幕问题。 学习起来并不容易,但一旦掌握了它,就需要处理很多UI问题。

使用Autolayout,你不需要加载两个XIB来支持iOS6和7。 参考:
官方文件
Raywenderlich教程

为iOS 6和iOS 7创build两个.xib并不是一个好主意,iOS 6和iOS 7的主要UI差异是iOS 7有额外的20px。 你只需要处理这些额外的20px。 Xcode已经给你控制来处理这个。

看到这篇文章模拟器中iOS6和iOS7的显示屏幕是不同的

你不应该打扰iOS6和iOS7的UI,使用系统元素(UINavigationbar,UISwitch,UIbutton等),它们的外观将根据iOS版本而改变。

从Apple Doc:

如果业务原因要求您继续支持iOS6或更早版本,则需要select最实用的方式来更新iOS7的应用程序。 您select的技术可能会有所不同,但整体build议保持不变:首先,重点关注为iOS7重新devise应用程序。 然后,如果重新devise包含导航或结构更改,请将这些更改适当地引入iOS6版本(不要将iOS 6版本的应用程序重新设置为使用iOS7devise元素,例如半透明酒吧或无边界酒吧button)

参考: 苹果文件

 i Have Got the Answer: Follow the Step Below to Upgrade Your App From IOS 6 To IOS 7 and its Working Fine in Below Simulator IOS 6: iPhone , iPad IOS 7: iPhone 3.5 inch , iPhone 4 inch, iPad **Follow the Step Below to Upgrade Your App** First Create Macro in App Delegate.m File #define iPhone5 @"iPhone 5" #define iPhone @"iPhone" #define iPad @"iPad" #define IS_IPHONE ([[[UIDevice currentDevice]model]hasPrefix:@"iPhone"]) #define IS_IPOD ([[[UIDevice currentDevice]model]hasPrefix:@"iPod touch"]) #define IS_HEIGHT_GET_568 [[UIScreen mainScreen]bounds].size.height==568.0f #define IS_IPHONE_5 (IS_HEIGHT_GET_568) #define IS_IPAD ([[[UIDevice currentDevice]model]hasPrefix:@"iPad"]) **Now in Application didFinishLaunching Option Method** //Check IOS Whether it is IOS 6 OR IOS 7 NSString *version = [[UIDevice currentDevice] systemVersion]; NSLog(@"IOS VERSION================%@",version); BOOL isAtLeast6 = [version hasPrefix:@"6."]; BOOL isAtLeast7 = [version hasPrefix:@"7."]; if (isAtLeast6) // if IOS Version 6 Then { if (IS_IPAD) //if IOS Version 6 and iPad Then { NSLog(@"IOS 6 Ipad Called"); viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController_iPad" bundle:nil] autorelease]; } else // if IOS 6 and iPhone The { NSLog(@"IOS 6 iPhone Called"); viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstView" bundle:nil] autorelease]; } } else if (isAtLeast7) { if (IS_IPHONE_5) { viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstView" bundle:nil] autorelease]; [viewController1 setEdgesForExtendedLayout:UIRectEdgeNone];//Automatically Set UI For IOS 7 NSLog(@" IOS 7 iPhone Called"); } else { viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstView" bundle:nil] autorelease]; [viewController1 setEdgesForExtendedLayout:UIRectEdgeNone]; } }