首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >IOS 6应用程序升级到IOS 7

IOS 6应用程序升级到IOS 7
EN

Stack Overflow用户
提问于 2013-12-17 07:14:33
回答 4查看 359关注 0票数 0

我想把我的应用程序从IOS 6升级到IOS 7.我的应用程序是通用的,为了升级到IOS 7,我创建了两个不同的XIB文件,一个用于IOS 6,一个用于IOS 7..and,我已经完成了升级,但问题是,当我在IOS 73.5模拟器或设备中运行我的应用程序时,我的应用程序在IOS 7 4英寸Simulator...but中运行得很好,那么它的图形和数据在其正常的Place...and中就不会显示,有时会崩溃。

代码语言:javascript
运行
复制
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"])
EN

Stack Overflow用户

回答已采纳

发布于 2013-12-20 12:29:25

代码语言:javascript
运行
复制
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];
        }


    }
票数 1
EN
查看全部 4 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20628088

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档