有没有办法更改UIDocumentInteractionController导航栏的色调/背景颜色?更改UIDocumentInteractionController导航栏的颜色
回答
如果您将UIDocumentInteractionController放到UINavigationController上,它会自动将其颜色作为其导航栏。这可能是您的根视图navcontroller。
你这样做与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;
}
[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:107.0/256.0 green:145.0/256.0 blue:35.0/256.0 alpha:1.0]];
放置在AppDelegate中的didFinisLaunching
方法的代码。它会改变整个应用程序导航栏的颜色。
一个清洁的版本@DOOManics实现:
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return [self navigationController];
}
巨大答案的颜色.. –
如果你不使用navigationController,你可以通过在这里的UIViewController的视图设置正确的设置,设置在UIDocumentInteractionController导航栏颜色你从中启动UIDocumentInteractionController。
比方说,你有UIViewController的viewController1(从这里你启动UIDocumentInteractionController),与故事板中的View1。
打开Storyboard后,单击viewController1上元素列表中的View1,然后转到右侧的“属性检查器”。这里设置的Background和Tint将会在你的UIDocumentInteractionController中使用。
然后,你可以使用:
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
}
注意,viewController1里面,你可能有一个导航栏具有不同的属性,它们不会在UIDocumentInteractionController使用。
似乎并没有为工作我在ios7上。我按照上述说明改变了色调和背景颜色,但预览视图控制器的按钮保持蓝色。 – kritzikratzi
试试这个代码:
- (void)openEC:(NSURL*)url {
[UINavigationBar appearance].tintColor = [UIColor blueColor];
docController = [UIDocumentInteractionController interactionControllerWithURL:url];
[docController setDelegate:self];
[docController presentOptionsMenuFromRect:self.view.bounds inView:self.view animated:YES];
}
- (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller {
[UINavigationBar appearance].tintColor = [UIColor whiteColor];
}
- 1. 更改导航栏的颜色
- 2. 更改UIActivityViewController的导航栏颜色
- 3. 更改折叠的导航栏颜色
- 4. Swift - iOS:更改导航栏的颜色
- 5. 更改导航栏的按钮颜色
- 6. 更改导航栏的颜色2.0.4
- 7. 更改导航栏的默认颜色
- 8. Xamarin.forms如何更改导航栏颜色
- 9. 灰度Bootstrap导航栏 - 更改颜色
- 10. 滚动时更改导航栏颜色
- 11. 更改导航栏背景颜色?
- 12. 更改导航栏文本颜色
- 13. Bootstrap-sass更改导航栏颜色
- 14. 在MFMailComposeViewController中更改导航栏颜色
- 15. iPad SplitView更改主导航栏颜色
- 16. 更改导航栏色调更改颜色不正确
- 17. 如何更改导航栏和导航文本颜色的背景颜色
- 18. 根据其位置更改导航栏颜色。颜色不变
- 19. 如何更改Liferay 6.2中的导航栏和导航栏的颜色
- 20. 如何更改导航栏上的导航栏链接轮廓颜色
- 21. 更改滚动条上的引导导航栏的颜色
- 22. 更改链接的颜色在我的引导导航栏
- 23. 更改导航栏的颜色(背景色)
- 24. 导航栏的HTML颜色
- 25. 无法更改引导程序3中导航栏的颜色?
- 26. 更改导航栏引导程序的文本颜色
- 27. 如何更改引导程序导航栏的颜色?
- 28. 以编程方式更改状态栏颜色等于导航栏颜色
- 29. 更改颜色导航栏,选项卡栏
- 30. iOS状态栏更改颜色以自行匹配导航栏
这将改变整个应用程序 –