Change NavigationBar background on UIDocumentInteractionController(更改UIDocumentInteractionController上的导航栏背景)
问题描述
我必须将本地PDF文件(文档目录)从UIWebView传递到其他应用(iBooks、Facebook Messenger、WhatsApp等)。
所以我使用UIDocumentInteractionController:
- (IBAction)shareButton:(id)sender
{
NSURL *url = [NSURL URLWithString:self.webView.request.URL.absoluteString];
self.docController = [UIDocumentInteractionController interactionControllerWithURL:url];
self.docController.delegate = self;
[self.docController presentOpenInMenuFromBarButtonItem:sender animated:YES];
}
如果我选择FB Messenger或WhatsApp,它会显示一个ViewController。
如何更改此VC的导航栏外观(背景图像/颜色、按钮色调)?默认白色半透明效果更好。
我在AppDelegate中设置了导航栏背景图像。
推荐答案
尝试此代码:
- (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];
}
这篇关于更改UIDocumentInteractionController上的导航栏背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!