Hiding UIBarbuttonItem of navigationcontroller swi

2019-04-13 02:41发布

问题:

New to swift implemented sliding menu by learning from swrevealviewcontroller swift

now i want to hide the menu button i.e. UIBarButtonItem which opens the side menu. I have searched found most of place following code:

menuBtn.enabled = false

but it only disables the button and not hide it.

Please let me know what wrong i am doing here.

回答1:

If it's the left button :

self.navigationItem.leftBarButtonItem.enabled = false;