任何人都可以向我解释一下....在 iphone 中是可能的。如果是,那么您能否逐步解释一下,因为我是 iphone 开发的新手。
问问题
710 次
1 回答
1
您可以做的最接近的方法是将 png 图像作为启动画面,其中包含您要播放的视频的第一帧,然后尽快播放视频。
一些帮助您入门的基本代码可能如下所示:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playBackDidFinishNotification:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"clip" withExtension:@"m4v"];
MPMoviePlayerViewController *viewController = [[MPMoviePlayerViewController alloc] initWithContentURL:URL];
viewController.moviePlayer.fullscreen = YES;
viewController.moviePlayer.controlStyle = MPMovieControlStyleNone;
[viewController.moviePlayer play];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)playBackDidFinishNotification:(NSNotification *)notification;
{
self.window.rootViewController = [[PSRootViewController alloc] init];
}
于 2013-01-23T12:18:38.977 回答