我有一个iPad应用程序,它使用MPMoviePlayerViewController
创建并显示视频。以下是我的代码:
MPMoviePlayerViewController *mpvc = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:URLEncode(uri)]];
[mpvc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[mpvc setWantsFullScreenLayout:YES];
[<MainViewController> presentModalViewController:mpvc animated:YES];
电影的加载/播放正常运行,但是当电影控制器出现时,它会在顶部显示状态栏(连接、电池、时间),即使我已经在主窗口中将其停用。
我尝试过:
[mpvc setWantsFullScreenLayout:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
但是似乎什么都不起作用,然而如果我也加入:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
状态栏消失了!但是电影控制器仍然调整大小,好像状态栏在那里(即使我已经使用了-setWantsFullScreenLayout:
)。
有人可以指点一下如何轻松(可行的)地显示视频而不显示状态栏吗?
谢谢。