📜  如何添加两个右栏按钮项 xcode - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:02.544000             🧑  作者: Mango

代码示例1
override func viewDidLoad() {
  super.viewDidLoad()

  let editImage    = UIImage(named: "plus")!
  let searchImage  = UIImage(named: "search")!

  let editButton   = UIBarButtonItem(image: editImage,  style: .Plain, target: self, action: "didTapEditButton:")
  let searchButton = UIBarButtonItem(image: searchImage,  style: .Plain, target: self, action: "didTapSearchButton:")

  navigationItem.rightBarButtonItems = [editButton, searchButton]
}