在我的应用中,我录制了一段视频&通过MpMovie播放器播放。看起来效果很好。
但是当我播放视频时,导航栏(默认进度条)会降下来而不是加入状态栏。
我播放视频的代码如下
-(IBAction)mth_play:(id)sender
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
NSString *VidLibrary = [paths objectAtIndex:0];
NSString *url = [VidLibrary stringByAppendingPathComponent:@"p.mp4"];
MPMoviePlayerViewController *pv=[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(playfinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:[pv moviePlayer]];
MPMoviePlayerController *pc=[pv moviePlayer];
[self.view addSubview:pv.view];
[pc play];
}
如何解决此问题?
答案 0 :(得分:1)
您是否有任何特殊原因将MPMoviePlayerViewController
的{{1}}添加为子视图?
您可以改为显示view
模式:
MPMoviePlayerViewController
或
[self presentViewController:pv animated:YES completion:nil]; // iOS 5+
答案 1 :(得分:0)