标签栏图标选择的图像 [英] tab bar icon selected image

查看:121
本文介绍了标签栏图标选择的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何自定义标签栏上的所选图像/图标?这可能吗?

How to customize the selected image/icon on the tab bar? Is this possible?

请告知。谢谢

推荐答案

可以不添加任何子视图。

Its possible without adding any subView.

在您定义标签栏的类将
tabBarItem的属性设置为 - >>

In the class where you define the tab bar set the property of the tabBarItem to ->>

UITabBarItem *tabBarItem1 = [[self.tabBar.tabBar items] objectAtIndex:0];
[tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"campaigns_hover.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"campaigns.png"]];

它是tabBarItem的属性,你可以将默认的蓝色图像更改为自定义图像。
campaigns_hover.png是选定的自定义图片,
campaigns.png是未选中的自定义图片...

Its a property of tabBarItem and u can change the default blue image to a custom image. campaigns_hover.png is the selected custom image AND campaigns.png is the custom image when not selected...

享受秘密.. :)

这篇关于标签栏图标选择的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆