我想把我的应用程序从IOS 6升级到IOS 7.我的应用程序是通用的,为了升级到IOS 7,我创建了两个不同的XIB文件,一个用于IOS 6,一个用于IOS 7..and,我已经完成了升级,但问题是,当我在IOS 73.5模拟器或设备中运行我的应用程序时,我的应用程序在IOS 7 4英寸Simulator...but中运行得很好,那么它的图形和数据在其正常的Place...and中就不会显示,有时会崩溃。
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"])发布于 2013-12-20 12:29:25
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];
}
}发布于 2013-12-17 07:18:02
我建议您查看Autolayout来解决设备屏幕问题。学习起来并不容易,但是一旦你掌握了它,它就会处理很多UI问题。
使用Autolayout,您将不需要加载两个XIB来支持iOS6和7。请参阅:
Raywenderlich教程
发布于 2013-12-17 07:19:56
为iOS 6和iOS 7创建两个iOS不是一个好主意,iOS 6和iOS 7的主要UI差异是iOS 7有额外的20 in。你只需要处理这些额外的20便士。Xcode给了您处理这个问题的控制权。
请看这篇文章模拟器中用于iOS6和iOS7的显示屏是不同的
https://stackoverflow.com/questions/20628088
复制相似问题