How do I hide/show the right button in the Navigation Bar

前端 未结 18 2027
后悔当初
后悔当初 2020-12-12 19:25

I need to hide the right button in the Navigation Bar, then unhide it after the user selects some options.

Unfortunately, the following doesn\'t work:



        
18条回答
  •  忘掉有多难
    2020-12-12 20:00

    To hide:

    if let topItem = self.navigationController?.navigationBar.topItem {
        topItem.rightBarButtonItem = nil
    }
    

提交回复
热议问题