• iOS开发——检测屏幕旋转


    步骤一、注册通知

       1:  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarOrientationChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];

    步骤二、判断方向

       1:  - (void)statusBarOrientationChange:(NSNotification *)notification
       2:   
       3:  {
       4:   
       5:  UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
       6:   
       7:  if (orientation == UIInterfaceOrientationLandscapeRight) // home键靠右
       8:   
       9:  {
      10:   
      11:  //
      12:   
      13:  }
      14:   
      15:  if (
      16:   
      17:  orientation ==UIInterfaceOrientationLandscapeLeft) // home键靠左
      18:   
      19:  {
      20:   
      21:  //
      22:   
      23:  }
      24:   
      25:  if (orientation == UIInterfaceOrientationPortrait)
      26:   
      27:  {
      28:   
      29:  //
      30:   
      31:  }
      32:   

    参考来源:http://www.2cto.com/kf/201410/345818.html

  • 相关阅读:
    css小随笔
    正则表达式的疑问
    笔记本各型号CPU性能比较
    调整Ajax的ValidatorCalloutExtender绑定后的提示字体
    GridView显示空表头
    VB.net检测输入内容
    asp.net中System.DateTime.Now.ToString()的一些用法
    收藏的手机论坛
    常用或者将要用的技巧或代码(网摘)
    使用Ajax的MaskedEditExtender来限制输入内容
  • 原文地址:https://www.cnblogs.com/zeyang/p/4457913.html
Copyright © 2020-2023  润新知