zoukankan      html  css  js  c++  java
  • 所有界面锁定屏幕方向,某一个界面支持屏幕旋转~

    //appdelagate.h 加
    @property (nonatomic, assign) BOOL allowRotation;

    //appdelegate.m加 
    -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
      if (self.allowRotation) {
        return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
      }
      return UIInterfaceOrientationMaskPortrait;
    }
    - (NSUInteger)supportedInterfaceOrientations
    {
      return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
    }
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
      return UIInterfaceOrientationPortrait;
    }

    打开屏幕旋转:

      AppDelegate  *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

      delegate.allowRotation = YES;

    关闭屏幕旋转:

      AppDelegate  *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

      delegate.allowRotation = NO;

  • 相关阅读:
    架构与模式11
    Unix/Linux命令
    Winform的Excel表格
    B/S结构一机多屏实现
    Effective C++函数参数传递方式
    Django & Tornado
    ThoughtWorks读书路线图
    善用泛型 委托
    SQL 关于with cube ,with rollup 和 grouping
    测试工程师实习笔试题
  • 原文地址:https://www.cnblogs.com/jyking/p/4884546.html
Copyright © 2011-2022 走看看