Adding multiple custom bar buttons to custom nav bar

后端 未结 3 1081

I need to add two bar button items to each end of my custom navigation bar in Swift. I\'m using the following method, and although I get no errors, nothing at all is ap

3条回答
  •  臣服心动
    2021-01-25 00:12

    My solution to do it:

    var barButton : UIBarButtonItem?
    
    override func viewDidLoad() {
        self.barButton = UIBarButtonItem(title: "Options", style: .plain, target: self, action: nil))
        self.navigationItem.rightBarButtonItems = [barButton] as? [UIBarButtonItem]
    }
    

提交回复
热议问题