需要获取设备方向变化(UIDeviceOrientation)的消息
2024-08-24 14:07:36
如果需要获得UIDeviceOrientation的转换消息的话,只需要:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];
在结束时候,需要移除注册的通知(dealloc)
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
- (void)orientationChanged:(NSNotification *)notification { ... }
最新文章
- Atitit.uke 团队建设的组织与运营之道attilax总结
- ubuntu-E:Encountered a section with no Package: header的解决办法 (转)
- Jenkins控制台中文输出乱码解决方法
- python IDE
- jQuery点击事件绑定onClick和on()
- java io读书笔记(4)字符数据
- AngularJS 1.5.0-beta.2 and 1.4.8 have been released
- Eclipse Error: Unable to set localhost. This prevents creation of a GUID.
- 多态VI的创建
- 搭建ntp时间服务器 ntp - (Network Time Protocol)
- MarkDown 编辑数学公式
- MyBatis学习——分步查询与延迟加载
- Python全栈开发-Day7-面向对象编程2
- Mysql 中Left/Right join on后面and和where条件查询的差异-Mysql SQL运算符是有优先级
- IDEA开发web程序配置Tomcat
- winform dataGridView DataGridViewComboBoxColumn 下拉框事件
- 正则表达式—RegEx(RegularExpressio)(二)
- Mysql修改语句的运行流程
- mysql-8.0.12安装和配置
- BroadcastReceiver学习