I have to pass a local PDF file (documents directory) from UIWebView to other apps (iBooks, Facebook Messenger, WhatsApp, ...).
So i use 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];
}
If i select FB Messenger or WhatsApp it shows a ViewController.
How can i change the NavigationBar appearance of this VC (background image/color, button tint)? Default white translucent would be nice.
I set a NavigationBar background image in AppDelegate.
if you use this line then Just remove this line and everything works well.
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
As for the Status Bar Style, the simplest way would be to pass self.navigationController as the presenter, instead of self:
- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
return self.navigationController;
}
It may be helpful to you
Try this code:
- (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];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.