LoginSignup
0
1

More than 3 years have passed since last update.

よく使うNavigationBar関連メモ

Posted at

//タイトル
self.navigationItem.title = "タイトル"
//タイトルの色
self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.blue]
//戻るボタンを隠す
self.navigationItem.setHidesBackButton(true, animated: true)
//左右にボタン追加
let leftButton = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: nil)
let rightButton1 = UIBarButtonItem(barButtonSystemItem: .undo, target: self, action: nil)
let rightButton2 = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: nil)
self.navigationItem.leftBarButtonItem = leftButton
self.navigationItem.rightBarButtonItems = [rightButton1, rightButton2]
//ボタンアイテムの色
self.navigationController?.navigationBar.tintColor = .red
//バーの色
self.navigationController?.navigationBar.barTintColor = .gray

Simulator Screen Shot - iPhone 8 Plus - 2021-02-17 at 11.39.17.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1