LoginSignup
3

More than 5 years have passed since last update.

status barをカスタマイズする

Last updated at Posted at 2016-08-27

以下をxibにナビゲーションバーを追加した後にAppDlegateに追記すればまとめてデザインを変更できます。

navigation bar

navigation barの背景色の変更

UINavigationBar.appearance().barTintColor = UIColor(red:0.20,green:0.60,blue:0.86,alpha:1.0)

navigation barの文字色の変更

UINavigationBar.appearance().tintColor = UIColor.whiteColor()

navigation barのタイトルのフォントを変更

UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Hiragino Sans", size: 17.0)!], forState: UIControlState.Normal)

Status bar

status barの色を変更

(status barはnavigation controllerを使うのでいらない気もしますが)

let statusBar = UIView(frame:CGRect(x: 0.0, y: 0.0, width: UIScreen.mainScreen().bounds.size.width, height: 20.0))
statusBar.backgroundColor = UIColor(red:0.20,green:0.60,blue:0.86,alpha:1.0)
view.addSubview(statusBar)

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
3