UIDocumentInteractionController presentPreviewAnimated navigation bar style is incorrect for ios15

346 Views Asked by At

I use the UIDocumentInteractionController to present an image full screen and since upgrading to xcode 13, iOS 15 devices have white and translucent navigation bars when doing [_documentInteractionController presentPreviewAnimated:YES];. All other navigation bars are fine.

This is what the delegate looks like

- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
    UINavigationController* navController = [self navigationController];
    navController.navigationBar.tintColor = [UIColor primaryColor];
    navController.navigationBar.barTintColor = [UIColor primaryColor];
    navController.view.backgroundColor = [UIColor primaryColor];

    return navController;
}

The closest I came to fixing the issue was doing this in the delegate

    UINavigationBarAppearance *app = [UINavigationBarAppearance new];
    [app configureWithOpaqueBackground];
    app.backgroundColor = UIColor.redColor;
    [[UINavigationBar appearance] setBarStyle: UIBarStyleBlack];

    navController.navigationBar.standardAppearance = app;
    navController.navigationBar.translucent = NO;

however the bar stays translucent. This is the result, the colour should be red. Navigation bar is translucent Setting navController.navigationBar.translucent = NO; doesnt seem to make a difference.

0

There are 0 best solutions below