2
第一次加載視圖時會應用動畫,但在此之後加載視圖時 - 什麼也不會發生。查看更改後動畫將不會重新啓動
應該直截了當 - 但是...
代碼:
- (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中的動畫沒有區別)
不幸的是,它沒有區別。 隨着當前動畫選項,它應該拿起它留下的最後一次,和動畫一遍遍...... – user648753
在某些時候我又增加了 [self.labelMarkTheSpot.layer removeAllAnimations] 移除並添加您建議的作品。謝謝 – user648753
沒問題!很高興聽到。 –