The tintColor
whenever I bring up the QLPreviewController
is pink by default. I wanted it to be a specific color so I set it like so
UINavigationBar.appearance().tintColor = UIColor.hexStringToUIColor(hexStr: "202020")
This is what the method that brings up the QLPreviewController
looks like
func openQLPreview() {
quickLookController = QLPreviewController()
UINavigationBar.appearance().tintColor = UIColor.hexStringToUIColor(hexStr: "202020")
quickLookController.dataSource = self
self.navigationController?.pushViewController(self.quickLookController, animated: true)
}
I want it to be the second color at all times, regardless of whether it is my first time calling QLPreviewController
or not. It switches back to the pink whenever the app is terminated and re-launched.
Edit (2/12/19)
I have solved it. The reason it wasn't working because I was setting the tintColor before the QLPreviewController
was pushed onto the navigationController
stack therefore, it was setting the tintColor
for the previous navigationItem in the stack (which is nothing because I am using a custom navigationBar
throughout my app). So when QLPreviewController
gets popped off the stack, and then pushed back in the next time I open a document, the tintColor
remains from when I last set it.
func openQLPreview() {
quickLookController = QLPreviewController()
quickLookController.dataSource = self
self.navigationController?.pushViewController(self.quickLookController, animated: true)
UINavigationBar.appearance().tintColor = UIColor.hexStringToUIColor(hexStr: "202020")
}
Therefore, simply setting the tintColor using UINavigationBar.appearance().tintColor
after QLPreviewController
has been pushed, fixed the issue.