简体   繁体   English

选择单元格后,UITableViewCell的图像更改

[英]UITableViewCell's image change when cell is selected

我将UIImageView设置为自定义单元格(原型单元格)的背景。选择单元格后,如何在图像视图中更改图像?

If you want to change the image of the imageview on cell selection then you will need to do it in delegate method of tableview here: 如果要在单元格选择上更改imageview的图像,则需要在以下tableview的委托方法中进行操作:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{}

If you have a custom cell and you have set its background as an image view then you must also create its property in custom cell's class and change the image of the image view through that property in the mentioned delegate. 如果您有一个自定义单元格,并且已将其背景设置为图像视图,则还必须在自定义单元格的类中创建其属性,并通过上述委托中的该属性来更改图像视图的图像。

您是否尝试过属性highlightImage?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM