84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
我想实现这种效果, 点击时 改变cell的背景色, 和里面label的颜色, 点击另一个时, 之前的一个恢复之前的颜色, 我试了试 用didSelectRowAtIndexPath 方法, 里面去得到cell, 改变颜色,但是当点击其他的cell的时候, 之前的cell如何恢复原样? 还是我的思路不对,请指教
学习是最好的投资!
Customize UITableViewCell and overload its methods
\- (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state // 这个判断selected,设置子试图状态 if (selected) { //...... } else { //...... } }
Seeing that you are a beginner, let me give you some directions first
// UILabel.h @property(nonatomic, strong) UIColor *highlightedTextColor
// UITableViewCell.h // 背景View @property (nonatomic, strong, nullable) UIView *selectedBackgroundView; // 选中事件 - (void)setSelected:(BOOL)selected {}
If you still have any questions, you can reply
Customize UITableViewCell and overload its methods