zoukankan      html  css  js  c++  java
  • 特定的界面支持横竖屏(可以modal或者push)

    -(void)forceToOriention:(UIInterfaceOrientation)direction

    {

        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 = direction;

            [invocation setArgument:&val atIndex:2];

            [invocation invoke];

        }

        

    }

    - (void)viewWillAppear:(BOOL)animated{

        [super viewWillAppear:animated];

         [self forceToOriention:UIInterfaceOrientationLandscapeRight];

    }

    - (void)viewWillDisappear:(BOOL)animated{

        [super viewWillDisappear:animated];

        [self forceToOriention:UIInterfaceOrientationPortrait];

     

    }

  • 相关阅读:
    jps命令
    Collection
    java.lang包中异常
    final关键字
    JVM运行时数据区域
    String详解
    哈希码
    Java虚拟机
    垃圾收集器与内存分配策略
    solr简介
  • 原文地址:https://www.cnblogs.com/YuFly-lyx/p/5614479.html
Copyright © 2011-2022 走看看