UITableViewCell设置所选图像 [英] UITableViewCell Set Selected Image

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

问题描述

试图弄清楚如何为 tableViewCell 设置所选图像。

trying to figure out how to set the selected image for for a tableViewCell.

旧方法写这个是 cell.selectedImage 但是自3.0以来已经弃用了。

The old way of writing this was cell.selectedImage but that has been deprecated since 3.0.

我尝试了很多东西,但是不能太好用。

I've tried numerous things, but can't get it too work.

谢谢!
Josh

Thanks! Josh

推荐答案

根据不推荐使用的UITableViewCell方法 doc,你应该使用imageView的highlightedImage属性来替代selectedImage 。例如:

According to the Deprecated UITableViewCell Methods doc, you should use the imageView's highlightedImage property as a replacement for selectedImage. For example:

UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
cell.imageView.image = [UIImage imageNamed:@"deselected_image.png"];
cell.imageView.highlightedImage = [UIImage imageNamed:@"selected_image.png"];

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

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