我目前有一个从应用程序启动时播放的 gif 转换而来的 mp4 视频,但使用视频会停止播放音乐并且连接的播放设备有问题。
无论如何,我真正想要的是在应用启动时显示我的 gif。但我似乎无法让 gif “播放”它只显示一帧,我如何让它播放整个 gif?
我当前的代码:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Show Animation;
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Launch" ofType:@"mp4"]];
LaunchPlayer = [[MPMoviePlayerViewController alloc]
initWithContentURL:url];
LaunchPlayer.view.frame = self.view.bounds;
LaunchPlayer.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
LaunchPlayer.moviePlayer.controlStyle = MPMovieControlStyleNone;
LaunchPlayer.view.tag = 1;
[self.view addSubview:LaunchPlayer.view];
[LaunchPlayer.moviePlayer play];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(LaunchFinish)
name:@"MPMoviePlayerPlaybackDidFinishNotification"
object:nil];
}