Adding buttons to toolbar programmatically in swift

前端 未结 6 1573
天命终不由人
天命终不由人 2021-02-04 03:14

I\'m having a hard time adding a button to the toolbar in swift, below you can see an image of the toolbar that I\'m after, unfortunately even though I have it designed in my St

6条回答
  •  梦毁少年i
    2021-02-04 03:19

    let addButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "addSomething:")
    toolbarItems = [UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: self, action: nil),addButton]
    self.navigationController!.setToolbarHidden(false, animated: false)
    

提交回复
热议问题