UITabBarItem setFinishedSelectedImage:在 iOS7 中已弃用 [英] UITabBarItem setFinishedSelectedImage: deprecated in iOS7
问题描述
setFinishedSelectedImage:withFinishedUnselectedImage:
在 iOS7 中已弃用.Apple 建议使用 image 的 settercode> 和
selectedImage
用 UIImageRenderingModeAlwaysOriginal
代替.我找不到关于如何使用 UIImageRenderingModeAlwaysOriginal
的任何示例.所以问题很简单:如何在 iOS7 中为 UITabBarItem
设置图片?
setFinishedSelectedImage:withFinishedUnselectedImage:
is deprecated in iOS7. Apple recommends to use setters of image
and selectedImage
with UIImageRenderingModeAlwaysOriginal
instead. I can't find any example of how to use UIImageRenderingModeAlwaysOriginal
. So the question is really simple: how to set images for UITabBarItem
in iOS7?
推荐答案
如果您想在 UITabBar 上实现实际图像的显示,请使用以下代码.
If you're are trying to achieve displaying of the actual image at the UITabBar then use the following code.
[yourTabBarItem setImage:[[UIImage imageNamed:@"more.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
如果您想以原始状态显示所选图像,请使用以下内容
and if you want to display image in original condition for the selected then use the following
[yourTabBarItem setSelectedImage:[[UIImage imageNamed:@"more.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
这两个是
setFinishedSelectedImage: withFinishedUnselectedImage:
这篇关于UITabBarItem setFinishedSelectedImage:在 iOS7 中已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!