更改UIDocumentInteractionController导航栏的颜色

Yog*_*wal 9 xcode objective-c ios4 uidocumentinteraction

有没有办法改变色调/背景颜色UIDocumentInteractionController navigationbar

dvd*_*sgn 14

@DOOManics实现的更清洁版本:

- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
    return [self navigationController];
}
Run Code Online (Sandbox Code Playgroud)


DOO*_*iac 4

如果将 UIDocumentInteractionController 放到 UINavigationController 上,它将自动采用其导航栏的颜色。这可能是您的根视图导航控制器。

您可以使用以下方法执行此documentInteractionControllerViewControllerForPreview操作:

- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller
{
    // Use the rootViewController here so that the preview is pushed onto the navbar stack
    MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
    return appDelegate.window.rootViewController;
}
Run Code Online (Sandbox Code Playgroud)