0

ビデオリストがあり、ユーザーがリストアイテムをクリックしたときにビデオプレーヤーを全画面で表示したいので、didSelectRowAtIndexPathmoethodにコードを追加します。

   [[[UIApplication sharedApplication].delegate window] addSubview:vc.view];

ビデオコントローラーで、ビューdidloadにNSNotificationCenterコードを追加し、アクションコードを追加します

    [[NSNotificationCenter defaultCenter] addObserver:moviePlayer
    selector:@selector(doneButtonClick:) name:MPMoviePlayerDidExitFullscreenNotification
    object:nil];

-(void)doneButtonClick:(NSNotification *)Notification{
    NSLog(@"...............doneButtonClick....... \n ");

    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidExitFullscreenNotification object:nil];

    [moviePlayer stop];
    [self.view removeFromSuperview];
}

完了ボタンをクリックすると動作しませんが、変更すると

   [[[UIApplication sharedApplication].delegate window] addSubview:vc.view];

   [[[UIApplication sharedApplication].delegate window] setRootViewController:vc];

完了ボタンは正常に機能します。MPMovieControllerを全画面表示のウィンドウに追加する理由と正しい方法を教えてくれます。ありがとうございます。

4

1 に答える 1

0

私はそれを自分でやっています、そしてそれは私にとってうまくいきます

[self presentModalViewController:movieController animated:YES];
    // Listen for interesting movie player notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedPlayback:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
于 2012-12-05T02:49:50.827 に答える