Skip to content

Instantly share code, notes, and snippets.

@tdtsh
Created January 17, 2016 02:28
Show Gist options
  • Save tdtsh/3a443bbc7192292ecc0a to your computer and use it in GitHub Desktop.
Save tdtsh/3a443bbc7192292ecc0a to your computer and use it in GitHub Desktop.
Swift2 で NavigationBar の 右にボタンを複数追加
override func viewDidLoad() {
super.viewDidLoad()
// ボタン達
let addButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "insertNewObject:")
let cameraButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Camera, target: self, action: "insertNewObject:")
let myRightButtons = [addButton, cameraButton]
// テンプレはこうだった
//self.navigationItem.rightBarButtonItem = addButton
// 右ボタン複数配置
self.navigationItem.setRightBarButtonItems(myRightButtons, animated: true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment