【发布时间】:2013-09-10 23:15:13
【问题描述】:
我正在使用 AVAnimator 库以便在我的 iOS 应用程序中使用电影动画。我的动画效果很好,但我需要能够在动画结束后移除它,并且即使在前一个动画完成之前也允许相同的动画在其自身之上播放。
这是我用来制作动画的代码:
bassView = [AVAnimatorView aVAnimatorViewWithFrame:CGRectMake(322,460,375,224)];
AVAnimatorMedia *media = [AVAnimatorMedia aVAnimatorMedia];
AV7zAppResourceLoader *resLoader = [AV7zAppResourceLoader aV7zAppResourceLoader];
resLoader.archiveFilename = @"Archive.7z";
resLoader.movieFilename = @"bass_iPad.mvid";
resLoader.outPath = [AVFileUtil getTmpDirPath:@"bass_iPad.mvid"];
media.resourceLoader = resLoader;
AVMvidFrameDecoder *frameDecoder = [AVMvidFrameDecoder aVMvidFrameDecoder];
media.frameDecoder = frameDecoder;
media.animatorFrameDuration = AVAnimator10FPS; // this is a constant I made for the frame rate
[media prepareToAnimate];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(animatorDoneNotification:)
name:AVAnimatorDoneNotification
object:media];
[mainView addSubview:bassView];
[bassView attachMedia:media];
[media startAnimator];
- (void)animatorDoneNotification:(NSNotification*)notification {
NSLog(@"animation done");
AVAnimatorMedia *media = notification.object;
[media stopAnimator];
[bassView removeFromSuperview];
}
【问题讨论】:
标签: ios objective-c core-animation