それを処理するための通知手法を実装できます。ムービー プレーヤーが再生されているクラスに通知を追加し、それにセレクターを関連付けます。アプリがバックグラウンドに移行すると、デリゲート メソッドで
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
UIApplication *app = [UIApplication sharedApplication];
UIBackgroundTaskIdentifier bgTask = 0;
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
}];
}
このコードを記述します。実際には、アプリがバックグラウンドになると MPMoviePlayerController が一時停止するため、フォアグラウンドになると、ムービー コントローラーが実装されているクラスのメソッドを呼び出す通知を投稿し、このメソッドで再度再生します。
-(void)playIntroAnimationAgain
{
[[NSNotificationCenter defaultCenter]removeObserver:self name:NOTIFICATION_PlayAgain_Player object:nil];
[self.moviePlayerController play];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playIntroAnimationAgain)name:NOTIFICATION_PlayAgain_Player object:nil];
}
それは私の問題を解決しました。