-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];
  }

完了ボタンをクリックすると、完了と呼ばれるボタンが 1 つあります。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 に答える