zoukankan      html  css  js  c++  java
  • iOS 8 强制横屏

    最近用到视频播放功能:(Vitamio, 注:在Build Setting 里面的 Other Link Flag 添加-all_load)

    iOS 8的屏幕旋转比较坑, 使用以下代码可以强制旋转

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
        return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );
    }
    
    - (BOOL)shouldAutorotate{
        return YES;
    }
    
    - (NSUInteger)supportedInterfaceOrientations{
        return UIInterfaceOrientationMaskAll;
    }
    
    //强制切换
    - (void)switchToLandspance{ [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationPortrait] forKey:@"orientation"];//这句话是防止手动先把设备置为横屏,导致下面的语句失效. [[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"]; }

    注意: 需要项目支持横屏旋转(Project Setting 里的 Device Orientation)

    转载请注明出处:http://duwei.cnblogs.com/
  • 相关阅读:
    [科普]DNS相关的攻击介绍
    php过滤函数
    robots.txt 文件指南
    【转】mysql函数
    java入门篇17 -- JDBC编程
    java入门16 -- http编程
    java入门篇14 --- tcp/udp
    java入门篇13 -- 多线程
    java入门篇12 --- IO操作
    java入门篇11 --- 集合
  • 原文地址:https://www.cnblogs.com/duwei/p/4581901.html
Copyright © 2011-2022 走看看