UItabBarItem 高亮状态图 [英] UItabBarItem highlight state image
问题描述
我希望能够在 UITabBarItem 被选中时更改突出显示的状态图像?是否可以子类化并访问它?还是我需要滚动自己的导航代码?
I'd like to be able to change the highlighted state image on an UITabBarItem when it is selected? Is it possible to subclass and access this? or do I need to roll my own navigation code?
-> 开始编辑我之前没有说明我在寻找什么.我正在寻找设备添加到 UITabBar 的选定状态/图像的半透明白色覆盖参考.看图!http://solomon71.com/images/UITabBarItem.png
-> start edit I didn't articulate what I was looking for earlier. I am looking for the semi-transparent white overlay reference that the device adds to the selected state/image of the UITabBar. See image! http://solomon71.com/images/UITabBarItem.png
推荐答案
没有记录或支持的方法来设置您自己的突出显示图像.话虽如此,在 2.2 中,您可以通过继承 UITabBarItem 并实现 -[UIImage *)selectedImage
来实现.
There is no documented or supported way to set your own highlighted image. Having said that, in 2.2 you could do it by subclassing UITabBarItem and implementing -[UIImage *)selectedImage
.
严格来说,您并不是在调用私有 API,因为 selectedImage 不是保留的方法名称(实际上是某人自己使用的相当合理的名称).话虽如此,我确信这不是故意的,它可能会在未来的版本中随时中断.如果这在 3.x 中已经被破坏了,我也不会感到震惊(我从来没有发布过这样做的任何东西,只是为客户端进行了试验).
Strictly speaking you are not calling private API, since selectedImage is not a reserved method name (and is actually a fairly reasonable name for someone to use themselves). Having said that, I am sure this is not intended and it could break at any time in a future release. It wouldn't shock me if this was already broken in 3.x (I never shipped anything that did this, just experimented with it for a client).
这篇关于UItabBarItem 高亮状态图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!