最初に下記のように記入しています。
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { UITabBarItem.appearance().setTitleTextAttributes([.font: UIFont.systemFont(ofSize: 9, weight: .bold), .foregroundColor: UIColor.init(red: 50/255, green: 50/255, blue: 50/255, alpha: 1)], for: .normal) return true }
そして、あるタブから違うControllerに移動し戻ってくると、そのタブ以外のテキストカラーがデフォルトに戻ってしまいます。これはなぜですか?しかし下記のように記入すると問題は解決します。
TabBarViewController.swift
override func viewWillAppear(_ animated: Bool) { let color = UIColor.init(red: 50/255, green: 50/255, blue: 50/255, alpha: 1) UITabBarItem.appearance().setTitleTextAttributes([.font: UIFont.systemFont(ofSize: 9, weight: .bold), .foregroundColor: color], for: .normal) tabBar.tintColor = color }
問題点の動画は下記リンクにあります。
https://streamable.com/z9d1j5
宜しくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/08/22 03:41