我必須在應用程序啓動時顯示一個小的介紹視頻,我也必須顯示啓動畫面(DEFAULT.png)。 所以在我的第一個視圖控制器的viewDidLoad中我做的:在應用程序啓動時顯示介紹視頻
NSURL * movieUrl = [[NSURL alloc] initFileURLWithPath: [[NSBundle mainBundle] pathForResource:@"movie" ofType:@"mp4"]];
self.playerController = [[MPMoviePlayerViewController alloc]initWithContentURL:movieUrl];
//Fit the screen
self.playerController.view.frame = CGRectMake(0, -20, 320, 480);
//Hide video controls
self.playerController.moviePlayer.controlStyle = MPMovieControlStyleNone;
//Play as soon as loaded
self.playerController.moviePlayer.shouldAutoplay = YES;
//Add the video as the first view background
[self.view addSubview:playerController.moviePlayer.view];
但是這個實現總是有當播放器視圖添加到視圖中的黑色閃光。有什麼辦法可以避免黑色閃光?
Manish感謝您的期待,但它沒有幫助。 – Soni