Ipad (IOS 3.2) では、オープニング .mov を再生する必要があるアプリを開発中です。ビデオ ( startUpVCにある間) の再生が終了すると、ウェルカム ページのために別の VC が呼び出されます。デリゲートで関数 [viewController.view removefromSuperView] を呼び出したときにいくつかの VC を変更した後、アプリがコードなしで (バックグラウンドで) startUpVCを呼び出していることがわかりました。ここに私のコードがあります:
StartupVCの内部
- (void)loadMovie {
NSLog(@"Load Movie");
NSString *path = [[NSBundle mainBundle] pathForResource:@"opening3" ofType:@"mov" inDirectory:nil];
NSURL *movieURL = [NSURL fileURLWithPath:path];
MPMoviePlayerViewController *theMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
theMoviePlayer.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[theMoviePlayer.moviePlayer setControlStyle:MPMovieControlStyleNone];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[theMoviePlayer.moviePlayer.view setFrame:self.view.bounds];
[theMoviePlayer.moviePlayer.view setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; [self.view addSubview:theMoviePlayer.view];
MPMoviePlayerController *startPlayer = [theMoviePlayer moviePlayer];
[startPlayer play];
デリゲートで
- (void)goTitle {
NSLog(@"go title");
IPAD03ViewController *vc = [[IPAD03ViewController alloc] initWithNibName:@"IPAD03ViewController" bundle:nil];
[viewController.view removeFromSuperview];
[window addSubview:vc.view];
- (void)goStart {
NSLog(@"go Start");
PageViewerVC *vc = [[PageViewerVC alloc] initWithPhotoSource:[PageSet samplePhotoSet]];
[viewController.view removeFromSuperview];
[window addSubview:vc.view];
- (void)goCredits {
NSLog(@"go credits");
CredtisVC *vc = [[CredtisVC alloc] initWithNibName:@"Credits" bundle:nil];
NSLog(@"1st");
[viewController.view removeFromSuperview];
NSLog(@"2nd");
[window addSubview:vc.view];
問題は、(1st) ( [viewController.view removeFromSuperview];) の後、終了 (go start) して goCredits 関数のデリゲートを呼び出すと、プログラムがバックグラウンドでムービーを再度再生することです ....
ありがとう!