MPMoviePlayerViewController的IOS分配问题

时间:2012-05-09 09:19:00

标签: memory-management ios-simulator instruments static-memory-allocation

在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]; 

}

0 个答案:

没有答案