I need to hide the share button button from QLPreviewController
this is the original code to show PDF (for example) into new view
var previewItem = NSURL()
func preview(_command: CDVInvokedUrlCommand){
self.previewItem = fileLocationURL! as NSURL
let previewController = QLPreviewController();
previewController.dataSource = self;
self.viewController?.present(previewController, animated: true, completion: nil);
}
extension PreviewAnyFile: QLPreviewControllerDataSource {
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
return 1
}
func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
return self.previewItem as QLPreviewItem
}
}
i tried this code (superclass the QLPreviewController into QLSPreviewController ) but the share button still exist
class QLSPreviewController : QLPreviewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true )
//This hides the share item
if let add = self.children.first as? UINavigationController {
if let layoutContainerView = add.view.subviews[1] as? UINavigationBar {
layoutContainerView.subviews[2].subviews[1].isHidden = true
}
}
}
}
PDFView
– Leo Dabus