0

在 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];)之后,程序将在后台再次播放电影......

谢谢!

4

1 回答 1

0

您在那里有一种纠结的电话网络,并且没有显示movieCallBack。您的问题闻起来像过度释放内存,然后将指针淡入这些方法。你有僵尸吗?

于 2011-04-19T18:36:05.800 回答