如何将mp4文件用作我的iphone应用程序的Splash屏幕而不是Default.png

时间:2013-01-23 12:10:34

标签: iphone objective-c ios6

任何人都可以解释一下......它可能在iphone中。如果是,那么你能逐步解释,因为我是iphone开发的新手。

1 个答案:

答案 0 :(得分: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];
}