簡體   English   中英

iOS UIView動畫問題

[英]iOS UIView Animation Issue

在UITabBarController中切換頁面時,我遇到了UIView動畫的問題。

UIViewControllerA中的視圖正在播放以下動畫: -

[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear | UIViewAnimationOptionBeginFromCurrentState animations:^{
        CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI);
        self.animationImageView.transform = transform;
    } completion:NULL];

動畫是一個自定義加載輪,在加載歌曲時停止。

如果我在頁面之間切換,即從UIViewControllerA切換到UIViewControllerB,然后在UITabController中返回到A,則動畫停止。 當我嘗試重新啟動它時,它不再動畫。

答案很簡單,重置轉換:

self.animationImageView.transform = CGAffineTransformIdentity;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM