首先解決橫屏問題
1.工程設置只支持豎屏
2.AppDelegate的window設置支持所有
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskAll;
}
3.UINavigationController或者BaseViewController只支持豎屏
(這樣保證了應用程序支持橫屏,而且平常的vc是豎屏,然後要橫屏的vc present出來)
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
4.播放器界面present出來,支持橫豎屏
-(BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
播放器界面present出來,支持橫屏
-(BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
//狀態欄設置ios7.0以上
-(void)playerViewDelegateSetStatusBarHiden:(BOOL)is_hiden
{
self.stauts_bar_hiden = is_hiden;
[self prefersStatusBarHidden]; //隱藏還是顯示
//更新statusbar
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; //刷新狀態欄
}
- (BOOL)prefersStatusBarHidden
{
return self.stauts_bar_hiden;
}