0
基本上,每當我播放聲音動畫放緩或暫停,該怎麼辦?幫助!當播放聲音動畫凍結暫停
聲音大小20kb mp3。
動畫尺寸5kb png。
代碼:
- (void) startAnimation {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.8];
CGPoint destination = CGPointMake(152,20);
pink.center = destination;
[UIView commitAnimations];
[soundPink play];
}
- (void) initSoundResources {
soundPink = [[APlayer alloc] initWithFile:@"pink" type:@"mp3"];
soundPink = 0.4;
}
首先感謝! 我是否需要更改initSoundResources方法中的某些內容? 我只是綜合soundPink,我需要做更多的事嗎? 如何將[UIViewsetAnimationDidStopSelector:@selector(playSound)]; 如果我需要定時器的聲音? [NSTimer scheduledTimerWithTimeInterval:1.8 target:self selector:@selector(playSound)userInfo:nil repeats:false]; – nil 2009-12-10 14:19:37
我給你的代碼應該工作,關於UIViewAnimation委託和didStopSelector。 關於你的initSoundResources,你不需要指定一個float到soundPink指針。編譯器當然應該警告你,你沒有看到它嗎? – Jasarien 2009-12-10 17:55:55
我沒有看到任何警告,你是什麼意思分配一個浮動? – nil 2009-12-10 21:55:41