0
我有一個的viewController我在哪裏玩用AVAudioPlayer
一個聲音和一個定時器正在運行使用NSTimer
2分鐘的動畫序列正在播放使用暫停計時器,UIView的動畫和音頻的iOS
[UIView animateWithDuration:2.0
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
//Rolling the Man's tongue out
_cooling2ManImage.alpha = 1.0;
_cooling3ManImage.alpha = 0.0;
}
completion:^(BOOL boolValue){
[UIView animateWithDuration:2.0
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
//showing the Arrow image and translating the arrow to the mouth
_cooling1ArrowImage.alpha = 1.0;
_cooling1ArrowImage.transform = CGAffineTransformMakeTranslation(0,-110);
}
completion:^(BOOL boolValue){
[UIView animateWithDuration:1.5
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
//Hiding the arrow
_cooling1ArrowImage.alpha = 0.0;
}
completion:^(BOOL boolValue){
_cooling1ArrowImage.transform = CGAffineTransformMakeTranslation(0,0);
[UIView animateWithDuration:2.0
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
//Roll the tongue back in
_cooling2ManImage.alpha = 0.0;
_cooling3ManImage.alpha = 1.0;
}
completion:^(BOOL boolValue){
//Show the arrow and translate it
[UIView animateWithDuration:2.0
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
_cooling3ArrowImage.alpha = 1.0;
CGAffineTransform scale;
CGAffineTransform translate;
scale = CGAffineTransformMakeScale(2.5, 2.5);
translate = CGAffineTransformMakeTranslation(0, 40);
_cooling3ArrowImage.transform = CGAffineTransformConcat(scale, translate);
_cooling3ArrowImage.alpha = 0.0;
}
completion:^(BOOL boolValue){
[UIView animateWithDuration:2.0
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
_cooling2ManImage.alpha = 0.0;
_cooling3ManImage.alpha = 1.0;
_cooling1ArrowImage.alpha = 0.0;
_cooling3ArrowImage.alpha = 0.0;
_cooling3ArrowImage.transform = CGAffineTransformMakeTranslation(0,0);
_cooling3ArrowImage.transform = CGAffineTransformMakeScale(1,1);
if (count <= 6) {
[self startAnimation1];
count += 1;
NSLog(@"%i",count);
}
}
completion:nil];
}];
}];
}];
}];
}];
我以實現暫停和恢復功能,以便當用戶點擊「暫停」按鈕時,音頻,動畫和計時器暫停,當用戶點擊恢復按鈕時,它會從暫停的地方恢復。可以讓任何人知道如何才能做到這一點?
如何暫停我正在使用的UIViewAnimation? – 2013-04-25 09:31:33
一旦檢查我的更新之一。 – Balu 2013-04-25 09:52:46
@SRS:這對你有幫助嗎? – Balu 2013-04-25 10:20:04