Allow video on landscape with only-portrait app

前端 未结 8 1412
没有蜡笔的小新
没有蜡笔的小新 2020-12-13 06:35

I have a UIWebView included in a UIViewController which is a descendant of UINavigationController. It looks like this:

8条回答
  •  情深已故
    2020-12-13 07:12

    I was having the same issue and using @entropid solution I was able to fix the navigation bar problem. But my view remains below the nav bar which I fix using "sizeToFit".

    [[NSNotificationCenter defaultCenter] addObserverForName:@"UIWindowDidRotateNotification" object:nil queue:nil usingBlock:^(NSNotification *note) {
        if ([note.userInfo[@"UIWindowOldOrientationUserInfoKey"] intValue] >= 3) {
            [self.navigationController.navigationBar sizeToFit];
            self.navigationController.navigationBar.frame = (CGRect){0, 0, self.view.frame.size.width, 64};
        }
    }];
    

    I haven't tested it properly but its working for me right now

提交回复
热议问题