UITabBarItem setFinishedSelectedImage:在iOS7中已弃用 [英] UITabBarItem setFinishedSelectedImage: deprecated in iOS7

查看:343
本文介绍了UITabBarItem setFinishedSelectedImage:在iOS7中已弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

setFinishedSelectedImage:withFinishedUnselectedImage:在iOS7中已弃用。 Apple 建议使用的setter图像 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屋!

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