在 viewDidLoad 的 ipad 应用程序中,我在第一个视图中设置了一个视频,以便进行介绍。在分配工具中,我看到在运行视频时分配的内存增长到 120MB,好吧我不在乎,但是在视频完成后,我希望该内存再次变为 0,但坚持到 120MB,我做错了什么?
- (void)viewDidLoad{
NSString *url = [[NSBundle mainBundle]
pathForResource:@"sfed"
ofType:@"mp4"];
playerViewController = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerViewController moviePlayer]];
[videoview addSubview:playerViewController.view];
MPMoviePlayerController *player = [playerViewController moviePlayer];
player.view.frame = CGRectMake(1024, 748, 0, 0);
[player setControlStyle:MPMovieControlStyleNone];
[player play];
}
- (void) movieFinishedCallback:(NSNotification*) aNotification {
MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[player stop];
[player release];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1];
[videoview setAlpha:0];
[UIView commitAnimations];
[videoview release];
}