1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

UITabBarControllerのボタンの色を変える

Posted at

はじめに

UITabBarControllerのボタンの色を変えたい。

環境

Xcode 12.4
Swift 5.3.2

実装

タブバーコントローラーに遷移する前の画面で色を指定しました。

MenuViewController
override func viewDidLoad() {
    UITabBar.appearance().tintColor = .red
    UITabBar.appearance().unselectedItemTintColor = .darkGray
}

func next() {
    let storyboard = UIStoryboard(name: "Next", bundle: nil)
    let next = storyboard.instantiateViewController(identifier: "Next")
    guard let tabBarCon = next as? UITabBarController else { return }
    self.navigationController?.pushViewController(tabBarCon, animated: true)
}

結果

スクリーンショット 2021-07-06 23.35.16.png

感想

今後も何度か調べそうな内容だなと思いました。
参考記事に感謝です。

参考記事

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?