我想優化我的應用程序iPhone 6和iPhone 6+iPhone 6/iPhone 6+啓動屏幕尺寸問題
但我有啓動屏幕大小問題。
我創建了一個簡單的項目,AppDelegate中的代碼是:
#import "AppDelegate.h"
#import "ViewControllerOne.h" //xib screen size is 4 inch.
#import "ViewControllerTwo.h" // xib screen size is 4.7 inch.
#import "ViewControllerThree.h" // xib screen size is 5.5 inch.
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if ([UIScreen mainScreen].bounds.size.height == 568.0) {//4 inch
ViewControllerOne *first = [[ViewControllerOne alloc]init];
UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:first];
self.window.rootViewController = navigation;
}
else if ([UIScreen mainScreen].bounds.size.height == 667.0){//4.7inch
ViewControllerTwo * second = [[ViewControllerTwo alloc]init];
UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:second];
self.window.rootViewController = navigation;
}
else if ([UIScreen mainScreen].bounds.size.height == 736.0){//5.5inch
ViewControllerThree *third = [[ViewControllerThree alloc]init];
UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:third];
self.window.rootViewController = navigation;
}
}
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
@end
當我運行iPhone 6或iPhone 6+模擬器,當我運行這個項目它總是出現4英寸屏幕(我包括三項啓動圖像([email protected],[email protected],[email protected])也。
我該怎麼做才能解決這個問題。
我查別人質疑與我的類似,並使用他們的代碼,但所有這些都不起作用,這可能是我的技術技能比較排。
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/LaunchImages.html – CSmith 2014-12-02 14:11:07
您是否在項目的plist中聲明瞭啓動映像?或者當你點擊項目文件時,項目「常規」選項卡? – Daniel 2014-12-02 14:32:57
謝謝鮑勃和史密斯!我剛剛解決了這個問題。我沒有在info.plist中聲明我的啓動圖像。我宣佈啓動圖像,一切都很好! – 2014-12-02 15:25:45