IOS 6 App Upgrade To IOS 7

回眸只為那壹抹淺笑 提交于 2020-01-06 14:05:22

问题


I want to Upgrade My App From IOS 6 To IOS 7... My App is Universal and For Upgrade to IOS 7 i have created Two Different XIB Files one for IOS 6 and One For IOS 7..and i have Complete the Upgrade but the Problem is My App is Running Perfect in IOS 7 4 inch Simulator...but when i Run My App in IOS 7 3.5 Simulator or Device then its Graphics and Data is not display in its proper Place...and sometime it crash...

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"])

回答1:


I recommend you to look at Autolayout to solve the device screen issues. It is not easy to learn but once you get hold of it, it takes care a lot of UI issues.

Using Autolayout, you will not need to load two XIBs to support iOS6 and 7 as well. Refer:
Official Document
Raywenderlich Tutorial




回答2:


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];
        }


    }



回答3:


Creating two .xib for iOS 6 and iOS 7 is not a good idea, main UI difference in iOS 6 and iOS 7 is that iOS 7 has extra 20px. you just have to handle these extra 20px. Xcode has given you control to handle this.

See this post Display screen for iOS6 and iOS7 in simulator is different




回答4:


You should not bother about the UI of iOS6 and iOS7, Use System Elements ( UINavigationbar, UISwitch ,UIbutton,etc..) their appearance will be change according to iOS version.

From Apple Doc:

If business reasons require you to continue supporting iOS6 or earlier, you need to choose the most practical way to update the app for iOS7. The techniques you choose can differ, but the overall advice remains the same: First, focus on redesigning the app for iOS7. Then—if the redesign includes navigational or structural changes—bring these changes to the iOS6 version as appropriate (don’t restyle the iOS 6 version of the app to use iOS7 design elements, such as translucent bars or borderless bar buttons).

reference: Apple Doc



来源:https://stackoverflow.com/questions/20628088/ios-6-app-upgrade-to-ios-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!