Skip to content

Instantly share code, notes, and snippets.

@KentarouKanno
Last active July 18, 2016 06:07
Show Gist options
  • Save KentarouKanno/2437e74b781bf47ecbdef43f415884cc to your computer and use it in GitHub Desktop.
Save KentarouKanno/2437e74b781bf47ecbdef43f415884cc to your computer and use it in GitHub Desktop.
UIBarButtonItem

UIBarButtonItem

★ Navigationの戻るボタンを設定する

// 文字列のボタンを生成
let leftBarbuttnoItem = UIBarButtonItem(title: "戻る", style: .Plain, target: self, action: #selector(NextViewController.backAction(_:)))
self.navigationItem.leftBarButtonItem = leftBarbuttnoItem

// ボタン押下時のアクション
func backAction(sender: UIBarButtonItem)  {
    self.navigationController?.popViewControllerAnimated(true)
}

★ UIBarButtonItemStyle

public enum UIBarButtonItemStyle : Int {
    case Plain
    case Done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment