I've applied UINavigationBar.appearence() with use of class UIAppearence() throught out the app. Due to this facing issue while showing UIActivityViewController() share doc, I want to remove navigation bar appearence only while showing share doc screen and then navigationbar should be back as usual when we come back.

UINavigationBar.appearence()

I'm trying to share pdf file using UIActivityViewController in iPhone and iPad, Able to share with below code but facing issue after tapping (...)more it opens to select any app that screen title(We have Done APPS and Edit button) is transparent, title Background should come white as default. Issue marked with red color rectangle. Title Background overrides with navigationbar appearence transparent property.

Let me know how to handle/remove appearence on navigationbar.

@objc func shareMenuTapped(button: UIBarButtonItem) {
     let url = NSURL.fileURL(withPath: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf") 
     let activityViewController = UIActivityViewController(activityItems: [url], applicationActivities: nil)
     activityViewController.popoverPresentationController?.sourceView = self.shareButton // so that iPads won't crash, sharebutton is a rightbarbutton to navigation.
     self.present(activityViewController, animated: true, completion: nil) 
}

enter image description here

enter image description here

1

There are 1 best solutions below

0
Varsha Shivhare On

Try to use the below code while presenting the activityViewController:

self.present(activityViewController, animated: true) { 
    UIBarButtonItem.appearance().tintColor = UIColor.systemBlue
    UINavigationBar.appearance().barTintColor = UIColor.white
}