步骤一、注册通知

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

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 

步骤二、判断方向

 

   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:   

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

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

最新文章

  1. GPS部标监控平台的功能设计(一)-功能列表
  2. 处理session跨域几种的方案
  3. 总结之H3C汇聚层交换机认证在线人数展示系统
  4. 习课的redis配置记录
  5. JVM byte code
  6. 【原】MyEclipse8.5集成Tomcat7时启动错误:Exception in thread “main” java.lang.NoClassDefFoundError
  7. c#多线程生产者消费者(手稿)
  8. Linux 系统常用命令汇总(二) vi 文本编辑
  9. Tombstone crash
  10. jquery基础教程读书总结
  11. Sqlserver 关于游标
  12. Python 基础篇:字符编码、函数
  13. html一些东东
  14. printf交替使用
  15. windows service and process 的关系
  16. PAT1048. Find Coins(01背包问题动态规划解法)
  17. android stuido 的几个点
  18. 50 years, 50 colors HDU
  19. ECMAScript5之Object学习笔记(一)
  20. ssh 配置文件讲解大全 ssh调试模式 sftp scp strace进行调试 特权分离

热门文章

  1. java.sql.Date和java.util.Date的不同和相互转换方式
  2. linux内核同步之每CPU变量、原子操作、内存屏障、自旋锁【转】
  3. nginx1.11.9 apt即源码编译各平台测试
  4. 关于一些Java基础数据类型的常用方法的应用场景的小思考
  5. 肢解 HTTP 服务器构建
  6. jquery 的combobox 处理级联
  7. delphi dispose释放内存的方法 New 和 GetMem 的区别
  8. 《Java编程思想》笔记 第五章 初始化与清理
  9. hdu 5179(数位DP||打表)
  10. 网络大数据分析 -- 使用 ElasticSearch + LogStash + Kibana 来可视化网络流量