views:

13

answers:

0

In Ipad (IOS 3.2) I am working on an app that needs to play a opening .mov. When the video (while located in startUpVC) is finished playing it will call another VC for a welcome page. After several VC changing when I called the function [viewController.view removefromSuperView] in delegate I found that the app called the startUpVC (in the background) without any codes. Here are my codes:

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

In Delegate

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

The prob is that when I finished (go start) and call the delegate for goCredits function, after (1st) ( [viewController.view removeFromSuperview];) the program will play the movie again in background ....

Thanks!