在Ipad(IOS 3.2)中,我正在开发一款需要打开.mov的应用程序。当视频(位于 startUpVC 中)播放完毕后,它将调用另一个VC作为欢迎页面。在几次VC更改后,当我在委托中调用函数[viewController.view removefromSuperView]时,我发现该应用程序名为 startUpVC (在后台)没有任何代码。 这是我的代码:
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];
代表
- (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];)程序将在后台再次播放电影....
谢谢!
答案 0 :(得分:0)
你有一种纠结的电话网络,并且没有显示movieCallBack。你的问题有点像内存的过度释放,然后指向这些方法的指针。你有僵尸吗?