添加按下去动画

This commit is contained in:
2025-11-20 20:36:31 +08:00
parent 8296ac12b6
commit 6bdd111a3a

View File

@@ -63,12 +63,18 @@
- (void)setHighlighted:(BOOL)highlighted {
[super setHighlighted:highlighted];
//
if (self.isSelected) {
self.alpha = 1.0;
} else {
self.alpha = highlighted ? 0.2 : 1.0;
//
//
NSLog(@"来了老弟=====");
CGFloat scale = highlighted ? 0.9 : 1.0; // 0.9~0.95
[UIView animateWithDuration:0.08
delay:0
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseOut
animations:^{
self.transform = CGAffineTransformMakeScale(scale, scale);
}
completion:nil];
}
- (void)setSelected:(BOOL)selected {