我有一個CAKeyframeAnimation
,當我從屏幕左側滑動手指(iOS 7中的向後滑動手勢)時,我想繼續玩。目前,當我向後滑動時,它會跳轉到它的startPosition,並且它保持靜態,並且看起來相當sl。。保持動畫播放ViewController被解僱?
ViewController
是我從另一個ViewController
推送的detailViewController
。當然,我不想在後臺解散detailViewController
後播放動畫。當它被解僱時,只需要。
這是我的動畫:
CGPoint startPoint = (CGPoint){160.f, 160.f};
CGPoint endPoint = (CGPoint){160.f, 15.f};
CGMutablePathRef thePath = CGPathCreateMutable();
CGPathMoveToPoint(thePath, NULL, startPoint.x, startPoint.y);
CGPathAddLineToPoint(thePath, NULL, endPoint.x, endPoint.y);
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animation.duration = 20.f;
animation.path = thePath;
animation.autoreverses = YES;
animation.repeatCount = INFINITY;
[self.myButton.layer addAnimation:animation forKey:@"position"];
任何幫助,將不勝感激,謝謝!
編輯與模式的詳細信息︰我有一個在一個TableView頂部的UIView(我沒有使用故事板的方式)。在這個UIView裏面是一個上下移動的UIButton。因此,UIView作爲一種「窗口」來看UIButton上下移動。當我滑回去,並且隨着detailViewController向右移動,我希望UIButton繼續進行動畫。 (在tableView之上,我的意思是它位於一個tableView之上,它不在它的頂層)。
你能描述一下你試圖完成的效果嗎?如果你只是試圖讓UIView在屏幕上滑動,那麼你可以以最難的方式做到這一點。 – InkGolem
我有一個桌面上的UIView(我沒有使用故事板的方式)。在這個UIView裏面是一個上下移動的UIButton。因此,UIView作爲一種「窗口」來看UIButton上下移動。當我滑回去,並且隨着detailViewController向右移動,我希望UIButton繼續進行動畫。 – user3127576
(在tableView之上,我的意思是它位於tableView之上,它不在它的頂層)。 – user3127576