0

iPhone 6 の AppDelegate.m に UIScreen 境界コードを追加したところ、iPhone 6 のデバイスの向きが縦向き/上下逆向きに機能しなくなりました。Upside Down は、シミュレーターとデバイスで機能しないものです。

AppDelegate.m のコード

 CGSize iosScreenSize = [[UIScreen mainScreen] bounds].size;

    if (iosScreenSize.height == 667) {

        UIStoryboard *iPhone6 = [UIStoryboard storyboardWithName:@"iPhone6" bundle:nil];

        UIViewController *initialViewController =[iPhone6 instantiateInitialViewController];

        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]bounds]];

        self.window.rootViewController = initialViewController;

        [self.window makeKeyAndVisible];
    }

上記のコードを含めたとき、iPhone 6 のシミュレーターとデバイスは上下逆さまの向きを検出しません。また、nativeBounds と screenBounds も使用しましたが、逆さまの向きでも機能しませんでした。

デバイスの向きの私のコード...

 -(NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
 }

iPhone 6 で UpSide Down の向きを検出できるように AppDelegate コードを取得する方法がわかりません。

4

1 に答える 1

0

OK、ついにこれを理解しました。

その後、誰かがここに答えを投稿したことに気付きました: Setting device orientation in Swift iOS

DaRk-_-D0Gの答えに行きます。

そのメソッドをオーバーライドするためだけに、タブ バー コントローラーをサブクラス化する必要がありました。非常に不快です。

于 2015-08-22T06:20:39.407 に答える