首页 > 移动平台 > 详细

iOS横屏问题

时间:2016-02-22 08:54:27      阅读:214      评论:0      收藏:0      [点我收藏+]

首先解决横屏问题
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;
}


转自:blog.csdn.net/u012241552/article/details/49023729
 

iOS横屏问题

原文:http://www.cnblogs.com/superbobo/p/5206072.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!