iphone - UITableViewCell 设置选中图片

标签 iphone objective-c ios uitableview

试图找出如何为 tableViewCell 设置所选图像。

旧的写法是 cell.selectedImage 但自 3.0 以来已被弃用。

我已经尝试了很多东西,但还是不太行。

谢谢! 乔希

最佳答案

根据Deprecated UITableViewCell Methods doc,您应该使用 imageView 的 highlightedImage 属性代替 selectedImage。例如:

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

关于iphone - UITableViewCell 设置选中图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4988777/

相关文章:

javascript - 在iPhone浏览器中上传照片时将默认设置切换为视频

Xcode 6.4 中的 iOS 模拟器显示多个版本并且名称中有长 "id"

iphone - 从 xib 中提取 UI 项目?

iphone - iOS 上的图像过滤选项

ios - 将 session 信息传输回 native 应用程序

ios - 为什么我的 tableview 很慢?

ios - Facebook 在 uitableview 中加载相册但不在下一个 Collection View 中打开

ios - 如何更改平板电脑上的 labelCount? (当有更多空间可用时)

iPhone:如何知道 UISlider 是否在滑动?

ios - 有没有办法呈现已经加载的 View Controller ?