zoukankan      html  css  js  c++  java
  • 强制横竖屏间切换

    if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
            SEL selector = NSSelectorFromString(@"setOrientation:");
            
            if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) {
                NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
                [invocation setSelector:selector];
                [invocation setTarget:[UIDevice currentDevice]];
                int val = UIInterfaceOrientationPortrait;//
                [invocation setArgument:&val atIndex:2];
                [invocation invoke];
            }else{
                NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
                [invocation setSelector:selector];
                [invocation setTarget:[UIDevice currentDevice]];
                int val = UIInterfaceOrientationLandscapeRight;//
                [invocation setArgument:&val atIndex:2];
                [invocation invoke];
            }
        }
    //屏幕旋转
    -(BOOL)shouldAutorotate{
        return YES;
    }
    //支持旋转的方向
    //一开始的屏幕旋转方向
    //支持旋转的方向
    //一开始的屏幕旋转方向
    - (NSUInteger)supportedInterfaceOrientations
    {
        NSLog(@"11222111111");
    
        return UIInterfaceOrientationLandscapeLeft;
    }
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return UIInterfaceOrientationLandscapeLeft;
    }
  • 相关阅读:
    程序书写规范
    点灯主要顺序
    复用功能重映射
    STM32 (战舰)
    html5 javascript 新增加的高级选择器更精准更实用
    html5 javascript 事件练习3键盘控制练习
    html5 javascript 事件练习3随机键盘
    html5 javascript 事件练习2
    html5 javascript 事件练习1
    html5dom2
  • 原文地址:https://www.cnblogs.com/songxing10000/p/4817899.html
Copyright © 2011-2022 走看看