第一次加载视图时应用动画,但之后加载视图时 - 没有任何反应。
应该是直截了当的-但是...
编码:
- (void)viewDidAppear:(BOOL)animated{
[self animateLabel];
}
- (void)viewWillDisappear:(BOOL)animated{
[self.labelMarkTheSpot.layer removeAllAnimations];
}
- (void)animateLabel{
UIViewAnimationOptions options = (UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionBeginFromCurrentState);
CGAffineTransform scaleFactor = CGAffineTransformMakeScale(1.1, 1.1);
[UIView animateWithDuration:0.2 delay:0 options:options animations:^{
self.labelMarkTheSpot.transform = scaleFactor;
}
completion:nil];
}
(在 viewWillAppear 中启动动画没有区别)