zoukankan      html  css  js  c++  java
  • 单个页面横屏!

    如果有NAVC可能会不好用
    你可以复写viewcontroller的下面几个模板函数,试试。

    - (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);当前viewcontroller是否支持转屏

    - (NSUInteger)supportedInterfaceOrientations;当前viewcontroller支持哪些转屏方向

    -(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation当前viewcontroller默认的屏幕方向

    可以试试这个方法:

    if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
           
           
    SEL selector = NSSelectorFromString(@"setOrientation:");
           
           
    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
           
            [invocation
    setSelector:selector];
           
            [invocation
    setTarget:[UIDevice currentDevice]];
           
            int val = UIInterfaceOrientationLandscapeLeft; // 选择屏幕旋转的样式
           
            [invocation
    setArgument:&val atIndex:2];
           
            [invocation invoke];
        }
  • 相关阅读:
    js原型杂谈
    arguments.callee.caller
    $resource
    sql的四种匹配模式
    AMD规范
    module.ngdoc
    angularjs杂谈
    浏览器前缀
    css21规范学习
    <meta>标签
  • 原文地址:https://www.cnblogs.com/yuhaojishuboke/p/5155868.html
Copyright © 2011-2022 走看看