marmelroy / FileBrowser

Finder-style iOS file browser written in Swift
MIT License
1.52k stars 222 forks source link

I've disabled the share button on the navigation bar but it still shows up? #14

Closed LieutenantKernel closed 8 years ago

LieutenantKernel commented 8 years ago

Probably a newbie question but I'm having a hard time getting rid of the rightBarButtonItem entirely. Any help would be much appreciated!

LieutenantKernel commented 8 years ago

I figured it out. You have to subclass QLPreviewController and then disable it in the viewDidLoad, viewDidAppear, and viewWillAppear. Then you must replace the superclass instances of the QLPreviewController with the subclass.

vijayvir commented 5 years ago

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
        if let add =  self.childViewControllers.first as? UINavigationController {
            if let layoutContainerView  = add.view.subviews[1] as? UINavigationBar {
                 layoutContainerView.subviews[2].subviews[1].isHidden = true
            }
        }
    }
}
Pradeep-21 commented 2 years ago

I am using layoutContainerView.subviews[1].subviews[1].isHidden = true then its works for me.