0
tabBarアイテムに選択状態とフォーカス状態に異なるタイトルの色を付けるにはどうすればよいですか?tvOSでUITabBarItemが選択され、フォーカスされている状態
タイトルテキストの属性を設定していますが、選択状態とフォーカス状態の間に違いはありません。常に同じ色です。ここで
は、私はタブバーのアイテムを作成する方法である:
for title in titlesArray {
let item = UITabBarItem(title: title, image: nil, selectedImage: nil)
item.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor(white: 1, alpha: 1)], for: .selected)
item.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor(white: 1, alpha: 0.2)], for: .normal)
item.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.blue], for: .focused)
tabBarItems.append(item)
}
tabbar.items = tabBarItems
いずれかが、私はこれを達成する方法を理解するのに役立ちます。ありがとう。
私の質問は:どのように私は、タブバーの項目に別のタイトルの色を与えることができます選択され焦点を合わせられた状態のために?通常の状態と選択された状態では、何が行われているのかが分かります。 –
これは何らかの方法で役立ちますか?https://stackoverflow.com/questions/34433009/how-to-change-tab-bar-item-text-colour-on-focus-in-tvos – Amit