How to hide share button in QLPreviewController using swift?

前端 未结 7 2156
无人共我
无人共我 2021-01-06 02:40

I\'m using the below code to use QLPreviewcontroller to show some documents in my app,

let ql = QLPreviewController()
ql.dataSource = self
//ql.navigationIte         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-06 03:15

    this work for me

       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
                let add =  self.childViewControllers.first as! UINavigationController
                let layoutContainerView  = add.view.subviews[1] as! UINavigationBar
                 layoutContainerView.subviews[2].subviews[1].isHidden = true
    
            }
        }
    

提交回复
热议问题