我有这个问题,并通过使用通知系统在马西维埃·克莱尔议员结束玩.后进行追捕,并释放该角色的物体来解决。
在电影上添加通知:
NSURL *url = [[[NSURL alloc]initFileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Movie" ofType:@"m4v"]] autorelease];
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc]initWithContentURL:url];
mp.movieControlMode = MPMovieControlModeDefault;
//***Add this line***
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:mp];
[mp play];
然后添加背书方法,
-(void)myMovieFinished:(NSNotification*)aNotification
{
MPMoviePlayerController *moviePlayer = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidFinishNotification object:moviePlayer];
[moviePlayer release];
}