UIDeviceOrientationDidChangeNotification和UIApplicationDidChangeStatusBarFrameNotification
这几天做App的时候,需要添加旋转屏通知以便调整UI布局
刚开始我使用的是UIDeviceOrientationDidChangeNotification,
一直有一些问题就是,如果使用这个通知,当iPhone/iPad旋转的时候,你会得到的旋转方向会是所有的
- UIDeviceOrientationUnknown和UIDeviceOrientationFaceUp等
- typedef enum {
- UIDeviceOrientationUnknown,
- UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom
- UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top
- UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right
- UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left
- UIDeviceOrientationFaceUp, // Device oriented flat, face up
- UIDeviceOrientationFaceDown // Device oriented flat, face down
- } UIDeviceOrientation;
但是我不需要对
- UIDeviceOrientationUnknown和UIDeviceOrientationFaceUp
进行处理,所以有时候就会出错,
后来更改为通知UIApplicationDidChangeStatusBarFrameNotification
在只有status更改位置的时候你才会收到通知,即你此时得到的方向只会是
- UIDeviceOrientationPortrait
- UIDeviceOrientationPortraitUpsideDown
- UIDeviceOrientationLandscapeLeft
- UIDeviceOrientationLandscapeRight
UIDeviceOrientationDidChangeNotification和UIApplicationDidChangeStatusBarFrameNotification的更多相关文章
- 关于监听与控制设备旋转全解析(UIDeviceOrientationDidChangeNotification)
一类情况: 初始化app的方向,比如只支持横屏或者竖屏.下面举例只支持竖屏的案例 在app的属性里面手动设置 上面标注了该app支持的方向种类,要是在app里支持Portrait方向,还需要添加以下代 ...
- iOS 系统消息
转载自:http://momirror.blog.163.com/blog/static/48418184201361541235481/ 一.键盘 1.UIKeyboardWillShowNotif ...
- iOS系统消息
一.键盘1.UIKeyboardWillShowNotification-将要弹出键盘2.UIKeyboardDidShowNotification-显示键盘3.UIKeyboardWillHideN ...
- iOS各种系统通知Name
当了一次搬运工,原地址:http://blog.csdn.net/db905517804/article/details/50569949 用法: - (void) viewWillAppear:(B ...
- iOS 工程默认只允许竖屏,在单独界面进行横竖转换,屏幕旋转
只含有 .关于横竖屏的代码 #import "InspectionReportViewController.h" #define SCREEN_WIDTH ([UIScreen m ...
- ios单独的页面支持横竖屏的状态调整,HTML5加载下(更新2)
单独的页面支持横竖屏的状态调整,HTML5加载下 工程中设置只支持竖屏状态,在加载HTML5的界面可以是横竖屏的,在不对工程其他界面/设置做调整的同时,可以这样去 #import "View ...
- iOS系统NSNotificationCenter中的常用通知名称
//音频 AVF_EXPORT NSString *const AVAudioSessionInterruptionNotification //音频中断出现 AVF_EXPORT NSString ...
- iOS 系统消息通知
一.键盘 1.UIKeyboardWillShowNotification-将要弹出键盘 2.UIKeyboardDidShowNotification-显示键盘 3.UIKeyboardWillHi ...
- iOS通知中心
iOS通知中心 它是iOS程序内部的一种消息广播机制,通过它,可以实现无引用关系的对象之间的通信.通知中心他是基于观察者模式,它只能进行程序内部通信,不能跨应用程序进程通信. 当通知中心接受到消息后会 ...
随机推荐
- jquery06 jQuery.extend 给jQuery函数添加、继承 静态方法
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- Android照片墙完整版,完美结合 内存方案 LruCache 和 硬盘方案 DiskLruCache
转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/34093441 在上一篇文章当中,我们学习了DiskLruCache的概念和基本用法 ...
- vue (v-if show 问题)
vue中的显示和隐藏有两种方式 1.v-if ( 相当于动态创建的标签,在html 结构中,是不存在的. ) 2. v-show(控制的是 html 的css display:none 属性.结 ...
- c# List集合学习
1---集合,可以理解成容器 泛型集合 非泛型集合2---使用集合用到的命名空间 using System.Collections.Generic;3---集合是如何来的?集合的前辈是数组,数组在内存 ...
- Postman APP
http://chromecj.com/web-development/2017-12/870.html Postman 工具模拟http各种协议请求.
- css3--根据数据加载显示的一个动画
css: .circle { width: 200px; height: 200px; position: absolute; border-radius: 50%; background: #0cc ...
- Google、Mozilla、Qt、LLVM 这几家的规范是明确禁用异常的
作者:陈硕链接:https://www.zhihu.com/question/22889420/answer/22975569来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出 ...
- [51Nod]NOIP2018提高组省一冲奖班模测训练(一)题解
http://www.51nod.com/contest/problemList.html#!contestId=72&randomCode=147206 原题水题大赛.. A.珂朵莉的旅行 ...
- java语言建立顺序表
package datastructure; //线性表 public interface IList { public void clear(); public boolean isEmpty(); ...
- UDP 打洞示例 包含 服务器 客户端
客户端示例: #include "Net.h" #include "../p2pInfo.h" int main() { CUdp udp; if (0!=u ...