更改UIDocumentInteractionController上的导航栏背景 [英] Change NavigationBar background on UIDocumentInteractionController

查看:56
本文介绍了更改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上的导航栏背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆