,我发现有CrossDisolve模式动画推出'MPMoviePlayerViewController'实例的方法是启动电影播放器,导航控制器内部,就像这样:
NSURL * videoUrl = [[NSURL alloc] initFileURLWithPath:videoPath];
MPMoviePlayerViewController * moviePlayerController = [[MPMoviePlayerViewController alloc] initWithContentURL:videoUrl];
UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:moviePlayerController];
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[navController setNavigationBarHidden:YES];
[self presentViewController:navController animated:YES completion:nil];
和听MPMoviePlayerPlaybackDidFinishNotification通知:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
,并关闭它在视频播放完毕:
-(void)movieDidFinish:(NSNotification *)notification {
[self dismissViewControllerAnimated:YES completion:nil];
}
谢谢毛茸茸的。实际上它并不是很有效 - 但是在你指向我的代码中存在秘密。如果你使用新的[self presentMoviePlayerViewControllerAnimated:theMoviePlayer];那么过渡样式将被忽略。但是,如果使用标准[self presentModalViewController:animated:],那么它适用于转换INTO电影,但在电影结束时仍然使用默认的幻灯片动画。奇! – 2010-09-13 09:56:09
..哦,这个链接有一些非常好的提示,使3.1/2和4.0兼容电影播放。干杯! – 2010-09-13 09:56:51