zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    第十四节:Web爬虫之Ajax数据爬取
    第十三节:web爬虫之Redis数据存储
    第十二节:Web爬虫之MongoDB数据库安装与数据存储
    第十一节:Web爬虫之数据存储(数据更新、删除、查询)
    第十节:Web爬虫之数据存储与MySQL8.0数据库安装和数据插入
    第九节:web爬虫之urllib(五)
    第八节:web爬虫之urllib(四)
    第七节:web爬虫之urllib(三)
    第六节:web爬虫之urllib(二)
    第五节:web爬虫之urllib(一)
  • 原文地址:https://www.cnblogs.com/zeyang/p/4457913.html
Copyright © 2011-2022 走看看