1

iOS アプリケーションを iPhone 5 に対応させたいので、iPhone 5 サイズ用の別の xib セットを作成しました。次に、画面の高さを確認して各 xib を読み込みます。

これは、AppDelegate.m 内のスプラッシュ スクリーン ロード コードです。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    UIViewController *viewController1;
    if ([UIScreen mainScreen].bounds.size.height==480) {
        viewController1 = [[SplashScreen alloc] initWithNibName:@"SplashScreen" bundle:nil];
    }


    if ([UIScreen mainScreen].bounds.size.height==568) {
        viewController1 = [[SplashScreen alloc] initWithNibName:@"SplashScreen5" bundle:nil];
    }

    self.window.rootViewController = viewController1;
    [self.window makeKeyAndVisible];
    return YES;
}

しかし、シミュレーターを Retina 4 インチに変更すると、コードがエミュレーターのサイズになりません。常に 480if条件を実行します。

しかし、このように作成した他のアプリは正常に動作しています。
これの理由は何ですか?

4

1 に答える 1