0

ユーザーが画面をタップすると、statusBar と navigationBar を非表示にしようとしています。これは問題なく動作しますが、navigationBar と statusBar が表示されて画面から消えると、常に「ビュー」のサイズが変更されます。したがって、 setWantsFullScreenLayout:YES が機能していないと思いました。ここにコードの抜粋があります:

- (void)loadView
{   
    // Make transparencies of bars and full screen
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
    [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent]; 
    [self setWantsFullScreenLayout:YES];       

    pagingScrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    /* ... */

    // Assign to UIScrollView !!
    self.view = pagingScrollView;
}

ただし、UIScrollView ではなく UIView に self.view を割り当てると、navigationBar と statusBar が表示されて画面から消えるときにビューのサイズが変更されることはありません

- (void)loadView
{   
    // Make transparencies of bars and full screen
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
    [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent]; 
    [self setWantsFullScreenLayout:YES];       

    pagingScrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    /* ... */

    // Assign to UIView !!
    UIView * mainView  = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [mainView addSubview:pagingScrollView];
    self.view = mainView;
}

だから私の質問は、ここにビューのサイズを変更するロジックがありますか?

前もって感謝します。

4

0 に答える 0