collectionView的cell中重寫下面兩個方法
- (void)setSelected:(BOOL)selected {
[super setSelected:selected];
if (selected) {
self.imageView.highlighted = NO;
}
}
- (void)setHighlighted:(BOOL)highlighted {
[super setHighlighted:highlighted];
if (highlighted) {
self.imageView.highlighted = YES;
} else {
self.imageView.highlighted = NO;
}
}
tableView的cell中重寫下邊兩個方法
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
if (selected) {
self.iconView.highlighted = NO;
}
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
if (highlighted) {
self.iconView.highlighted = YES;
} else {
self.iconView.highlighted = NO;
}
}