swift - 在导航栏NavigationController上设置右侧按钮图片

iSwift

2018-01-04T07:34:16Z||2018-01-04T07:34:16Z

  private func addRightButton() {
      let img = UIImage(named: "myIcon")
      navigationItem.rightBarButtonItem = UIBarButtonItem(image: img, style: .plain, target: self, action: #selector(rightButtonTapped))
  }

  @objc private func rightButtonTapped() {
      print("Right button tapped")
  }