0

次のクラスをセットアップしました: MESSidePanelViewControllerSubClass ヘッダー ファイル

@property BOOL setLandscapeOK;

インプファイル

- (NSInteger)supportedInterfaceOrientations {
    // Restriction for the welcome page to only allow potrait orientation

    if (setLandscapeOK == YES) {
        NSLog(@"Reveal-setting all");
        return UIInterfaceOrientationMaskAll;
    }
    NSLog(@"Reveal-setting portrait");
    return UIInterfaceOrientationMaskPortrait;
}

別のファイル(View Controller)から値を更新したいと思います。
LoginViewController その他のビュー コントローラの imp ファイル

- (NSInteger)supportedInterfaceOrientations {
    // Restriction for the welcome page to only allow potrait orientation
    NSLog(@"Login-supportInterfaceOrientations");
    MESSidePanelViewControllerSubClass* setLandscapeOK = YES;
    return UIInterfaceOrientationMaskAll;
}

エラーが発生します:

Implicit conversion of 'BOOL' (aka 'signed char') to 'MESSidePanelViewControllerSubClass *' is disallowed with ARC

別のファイルの BOOL 値を更新するにはどうすればよいですか?

4

2 に答える 2

0

この行は間違っています:

MESSidePanelViewControllerSubClass* setLandscapeOK = YES;

次のようになります: (また、mESSidePanelViewControllerSubClass はおそらく iVar であり、supportedInterfaceOrientations メソッドの外部のどこかでインスタンス化されます。)

 MESSidePanelViewControllerSubClass *mESSidePanelViewControllerSubClass = [MESSidePanelViewControllerSubClass alloc] init];

それから:

mESSidePanelViewControllerSubClass.setLandscapeOK = YES;

デリゲートへのリンクを追加するために編集されました。

于 2013-02-15T23:20:45.623 に答える
0

常に返す必要-supportedInterfaceOrientationsは ありませんか?のインスタンスが子ビュー コントローラーとしてプッシュされた場合、UI の向きが強制的に縦向きになることはありませんか? あなたはそれを試しましたか?MESSidePanelViewControllerSubClassUIInterfaceOrientationMaskPortraitMESSidePanelViewControllerSubClass

于 2013-02-17T01:23:06.380 に答える