MPMoviePlayerViewController not appearing
I'm attempting to load a small movie for a Title/Splash screen. However, when I call presentMoviePlayerViewControllerAnimated
nothing happens. I have confirmed that the block of code is being executed, but there is nothing perceptible to the user.
I am targeting the iPad, so 3.2 is assumed.
开发者_高级运维Any help would be appreciated.
- (void)viewDidLoad {
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"Intro" ofType:@"m4v" inDirectory:nil];
NSURL *fileURL = [NSURL fileURLWithPath:path];
MPMoviePlayerViewController *playerView = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(playbackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:playerView.moviePlayer];
[self presentMoviePlayerViewControllerAnimated:playerView];
[playerView release];
}
- (void)playbackDidFinish:(NSNotification*)aNotification {
MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[player stop];
[self dismissMoviePlayerViewControllerAnimated];
}
you should place the line [playerView release]; after this line [self dismissMoviePlayerViewControllerAnimated];
精彩评论