我必须将UIWebView的本地PDF文件(文档目录)传递给其他应用程序(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的NavigationBar外观(背景图像/颜色,按钮色调)?默认白色半透明会很好。
我在AppDelegate中设置了NavigationBar背景图像。
最佳答案
试试这个代码:
- (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];
}
关于ios - 更改UIDocumentInteractionController上的NavigationBar背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37703314/