zoukankan      html  css  js  c++  java
  • iOS横屏问题

    首先解决横屏问题
    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
     
  • 相关阅读:
    前端全链路优化总结
    到底使用字符数组还是字符串常量
    指针的误区
    指针
    函数使用初体验
    C语言函数使用小试牛
    十年研发经验工程师的嵌入式学习书籍大推荐与学习进阶路线
    TCP/IP协议前期的一知半解
    Ubuntu 16.04 LTS安装sogou输入法详解
    1/0信封——数据链路层,ARP及RARP
  • 原文地址:https://www.cnblogs.com/superbobo/p/5206072.html
Copyright © 2011-2022 走看看