블로그 이미지
게임같은 인생 인생같은 게임 쿡지

카테고리

분류 전체보기 (12)
준&빈 (1)
나만의 개념 챙기기 (2)
My Story (0)
cocos2d-x (7)
My Games (0)
My_Work (0)
Etc (2)
Total
Today
Yesterday

iOS 6 Tips and Tricks Upgrading Your Apps

Here is what I have learned so far upgrading our apps to iOS 6. Figure this will help some people out. Orientation support is instantly broken the minute I built my apps against iOS 6. 

Root View Controller warning?

 Warning:

Application windows are expected to have a root view controller at the end of application launch

 Change in app delegate didFinishLaunchingWithOptions:

[window addSubview:navigationController.view];

 To:

[window setRootViewController:navigationController];

iOS 6 New Orientation Methods

Set orientation in Info.plist or Summary screen. Then add following code to root view controller class only. Note that if you add a navigation controller to your window, in your app delegate’s didFinishLaunchingWithOptions, you need to create a class that has a subclass of UINavigationController and change your class to this type.

- (BOOL)shouldAutorotate {

return YES;

}

\\replaces – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

- (NSUInteger)supportedInterfaceOrientations {

return UIInterfaceOrientationMaskLandscape;

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

return UIInterfaceOrientationLandscapeRight;

}

The preferredInterfaceOrientationForPresentation method will rotate your view to whatever you set it to when a view is loaded. Be careful as when you come back to your view it may be upside down. Do not include this method if you don’t want it to override the current orientation when you dismiss say a UIImagePickerController.

UIImagePickerController crash

 Crash:

Terminating app due to uncaught exception ‘UIApplicationInvalidInterfaceOrientation’, reason: ‘Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES’

 Add to app delegate:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)w {

return (NSUInteger)[application supportedInterfaceOrientationsForWindow:w] | (1<<UIInterfaceOrientationPortrait);

}

Test for iOS Version

Here is the best way to test for iOS Version:

NSString *reqSysVer = @”6.0″;

NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

BOOL versionHigher = [currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending;

New iPhone 5 screen dimensions

 Warning:

Missing “Default-568h@2x.png” launch image

Once you create this file, the letter boxing will disappear. XCode will even ask you if you want it to create the file.

Depending on your screens layouts, you may just have to make sure your MainWindow.xib is set to Full Screen at Launch. Otherwise you may have to do specific layouts for just the iPhone 5.


출처 : http://grembe.wordpress.com/2012/09/19/here-is-what-i/


Posted by 알 수 없는 사용자
, |

최근에 달린 댓글

글 보관함