OGeek|极客世界-中国程序员成长平台

标题: ios - 选择行时更改 UIImageView 中的图像? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:06
标题: ios - 选择行时更改 UIImageView 中的图像?

这是项目被选中时的外观。

enter image description here

通常行有黑色背景,图标有白色前景。但是选择一行会使背景变成半白色。选择 imageView 的行时,是否可以将图像更改为相反的颜色,或者在 imageView 中使用不同的图像?



Best Answer-推荐答案


使用@NSDmitry 的示例,您需要在 UITableViewCell 上覆盖 setSelected(_ selected: Bool, animated: Bool) 并设置 tintColor 整个 contentView 或只是 imageView

关于ios - 选择行时更改 UIImageView 中的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42510466/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4