ios - selected and focused states of UITabBarItem on tvOS -




how can give tabbar items different titles colors selected , focused states?

i setting title text attributes not make difference between selected , focused states, have same color.

here how create tabbar items:

   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 

can 1 me understand how achieve this. thanks.

try if can in anyway :

for normal:

 uitabbaritem.appearance().settitletextattributes([nsforegroundcolorattributename: uicolor.graycolor()], forstate:.normal) 

and selected :

   uitabbaritem.appearance().settitletextattribute([nsforegroundcolorattributename:uicolor.redcolor()], forstate:.selected) 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -