在我的应用程序中,我使用 MPMoviePlayerController 在我的第一类 XIB 中运行视频。我的视频持续时间约为 20 秒。我希望当我的视频结束时它自动调用第二类 XIB。这是我的代码。
-(void)viewWillAppear:(BOOL)animated
{
NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"3idiots.mov" ofType:nil];
NSURL *url = [NSURL fileURLWithPath:urlStr];
videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[self.view addSubview:videoPlayer.view];
videoPlayer.view.frame = CGRectMake(0, 0,768, 1000);
[videoPlayer play];
[self performSelector:@selector(gotonextview)];
}
-(void)gotonextview
{
secondview *sec=[[secondview alloc] initWithNibName:@"secondview" bundle:nil];
[self presentModalViewController:sec animated:YES];
[sec release];
}
这段代码给我没有错误,但在视频完成后它不会调用第二类。任何人都可以指导我。提前感谢