いくつかのページを含む tabBarViewController と loginViewController があります。[window addSubView:] を使用してビューを追加します。
フルスクリーン ビデオを再生する必要がある場合、ビデオを表示するためにウィンドウ内のすべてのビューを削除する必要があります。そうしないと、単なる黒い画面になります。ビデオがフルスクリーンで停止/終了/終了すると、サブビューを手動でウィンドウに再度追加する必要があります。
私はこれが間違ったやり方であることを知っています。このようにしないと、ビデオが全画面表示に切り替わると、ルート ウィンドウ ビューで他のビューの後ろに表示されます。
アドバイスをお願いします。ありがとうございました。
以下は私のコードです:
-(void)playMovie:(NSString *)urlStr{
NSURL *fileURL = [NSURL URLWithString:urlStr];
player = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
player.scalingMode = MPMovieScalingModeAspectFit;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterFullscreen:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willExitFullscreen:) name:MPMoviePlayerWillExitFullscreenNotification object:nil];
[[appDelegate loginViewController].view removeFromSuperview];
[[appDelegate tabBarController].view removeFromSuperview];
[[appDelegate navController].view addSubview:player.view];
player.fullscreen = YES;
[player play];
}
- (void)willExitFullscreen:(NSNotification*)notification {
NSLog(@"willExitFullscreen...");
[[appDelegate window] addSubview:[appDelegate navController].view];
[[appDelegate window] addSubview:[appDelegate loginViewController].view];
[[appDelegate window] addSubview:[appDelegate tabBarController].view];
[player.view removeFromSuperview];
}