-2
  if (indexPath.row==0) 
  {
    NSString *urlAsString = [[NSBundle mainBundle]  pathForResource: [self.array objectAtIndex:indexPath.row] ofType:@"mov"];

    NSURL *url = [NSURL fileURLWithPath:urlAsString];

    MPMoviePlayerController *myPlayer = [[MPMoviePlayerController alloc] init];
    myPlayer.shouldAutoplay = YES;
    myPlayer.repeatMode = MPMovieRepeatModeOne;
    myPlayer.fullscreen = YES;
    myPlayer.movieSourceType = MPMovieSourceTypeFile;
    myPlayer.scalingMode = MPMovieScalingModeAspectFit;
    myPlayer.contentURL =[NSURL fileURLWithPath:urlAsString];
    [self.view addSubview:myPlayer.view];

    [myPlayer.view setFrame:CGRectMake(0, 0, 320, 400)];
    [myPlayer setFullscreen:YES animated:YES];
    [myPlayer play];
  }

当我单击完成按钮时,我有一个MPMoviePlayerController称为完成的按钮我需要回到我的tableview请帮助我任何一个

4

1 回答 1

0

MPMoviePlayerController *myPlayer 声明 global 和 init 。和

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(doneButtonClick:) 
                                             name:MPMoviePlayerWillExitFullscreenNotification 
                                           object:nil];

和选择器方法:

-(void)doneButtonClick:(NSNotification*)aNotification{
[myPlayer stop];
}
于 2013-07-11T12:19:48.830 回答