UITabBar tint in iOS 7

后端 未结 4 2438
春和景丽
春和景丽 2021-02-19 15:31

How can i specify the tint of images when a tab is selected and unselected?

I have tried this but it doesnt work:

[[UITabBar appearance] setTintColor:[UI         


        
4条回答
  •  走了就别回头了
    2021-02-19 16:00

    You can set the tint color for selected and unselected tab bar buttons like this:

    [[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor redColor]];
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
    

    The first line sets the unselected color - red in this example - by setting the UIView's tintColor when it's contained in a tab bar. Note that this only sets the unselected image's tint color - it doesn't change the color of the text below it.

    The second line sets the tab bar's selected image tint color to green.

提交回复
热议问题