在 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];
问题是当我完成(开始)并调用 goCredits 函数的委托时,在(1st)([viewController.view removeFromSuperview];)之后,程序将在后台再次播放电影......
谢谢!