我该如何修复MPMoviePlayerViewController

时间:2014-07-02 09:14:05

标签: ios mpmovieplayercontroller

我点击这里的按钮是代码

//NSURL *url = [NSURL URLWithString:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"];
_moviePlayer =  [[MPMoviePlayerController alloc]
                 initWithContentURL:self.urlFile];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayBackDidFinish:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:_moviePlayer];

_moviePlayer.controlStyle = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
[self.view addSubview:_moviePlayer.view];
_moviePlayer.view.frame = CGRectMake(0, 0, 320, 300);
[_moviePlayer setFullscreen:YES animated:YES];

它会播放但是当我按完成按钮时,这是方法

- (void) moviePlayBackDidFinish:(NSNotification*)notification {
    MPMoviePlayerController *player = [notification object];
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:MPMoviePlayerPlaybackDidFinishNotification
                                                  object:player];


    [player stop];
    player.initialPlaybackTime = -1;
    [player.view removeFromSuperview];


}

看起来像这样

抱歉没有足够的帖子发布

底部有黑色衬里,播放按钮也会消失,如何将其加载回按下单元格时的点并进入detailViewController

0 个答案:

没有答案