サイトアイコン Dev-Dev

【Swift】ナビゲーションバーの色を変更する

【Swift】ナビゲーションバーの色を変更する

ナビゲーションバーの色を変える方法。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
//ナビゲーションアイテムの色を変更
UINavigationBar.appearance().tintColor = UIColor.redColor()
//ナビゲーションバーの背景を変更
UINavigationBar.appearance().barTintColor = UIColor.yellowColor()
//ナビゲーションのタイトル文字列の色を変更
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.greenColor()]
return true
}

↓参考サイト

モバイルバージョンを終了