iphone怎么检测屏幕是否被点亮 (用UIApplication的Delegate)
本文转载至 http://gaohaijun.blog.163.com/blog/static/176698271201161524857373/
|
问题:那位能说一下怎么能检测到iphone的屏幕现在是否在被点亮的状态,还是被关闭的黑屏状态,
|
没有测试,但是相信可以。
刚刚测试,假如是子类化UIApplication是无法接受到这个方法的。用Objc Runtime的method_exchangeImplementations(method, method)就可以。
以下代码:
UIApplication方面:
|
UIApplicationDelegate:
|
以上代码在打开后关闭屏幕再打开的条件下输出:
引用2009-08-17 19:05:37.770 *[380:207] Application did become active.
2009-08-17 19:06:36.370 *[380:207] Did turn off display.
2009-08-17 19:06:36.452 *[380:207] Application will resign active.
2009-08-17 19:06:43.310 *[380:207] Did turn on display.
2009-08-17 19:06:43.415 *[380:207] Application did become active.
可见这个是方法在delegate的willResignActive和didBecomeActive之前调用。
- (void)applicationWillResignActive:(UIApplication *)application;
而解锁后变亮会触发
- (void)applicationDidBecomeActive:(UIApplication *)application;
iphone怎么检测屏幕是否被点亮 (用UIApplication的Delegate)的更多相关文章
- 将网站添加到iPhone的主屏幕上
我之前有篇文章介绍过如何将网站固定到Windows的开始菜单,并可以自定义图标.颜色以及Windows推送通知,其实Apple也有类似的功能,通过在网页的head部分添加link标记,在Safari浏 ...
- 转载:iPhone 6 Plus 屏幕宽度问题 375 vs 414
首先看一张比较简单明了的 iPhone 6 与 iPhone 6 Plus 对比图,来自 PaintCode 的<The Ultimate Guide To iPhone Resolutions ...
- iPhone手机的屏幕尺寸、分辨率及适配
1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS ...
- iphone及ipad屏幕尺寸参考
初代iPhone 2007年,初代iPhone发布,屏幕的宽高是 320 x 480 像素.下文也是按照宽度,高度的顺序排列.这个分辨率一直到iPhone 3GS也保持不变.那时编写iOS的App(应 ...
- iPhone设备及屏幕适配
// // Common.h // 微信 // // #ifndef Common_h #define Common_h // iPhone设备及屏幕适配 //4的设备 #define KDevice ...
- jquery检测屏幕宽度并跳转页面
jquery检测屏幕宽度并刷新页面 var owidth = ($(window).width()); //浏览器当前窗口可视区域宽度 if(owidth<640){//小于640跳转一个网址, ...
- js 检测屏幕分辨率
js 检测屏幕分辨率 class screenChecker { constructor() { this.screen = window.screen; this.fullscreen = fals ...
- iPhone 12 Pro 屏幕时间设置的密码锁出现弹窗 UI 错位重大 Bug
iPhone 12 Pro 屏幕时间设置的密码锁出现弹窗 UI 错位重大 Bug iOS 14.1 Bug 弹窗 UI 非常丑 弹窗屏占太高了 屏幕使用时间 https://support.apple ...
- 监听iOS检测屏幕旋转状态,不需开启屏幕旋转-b
-(void)rotation_icon:(float)n { UIButton *history_btn= [self.view viewWithTag:<#(NSInteger)#>] ...
随机推荐
- sqlmap工具命令行的含义
SQLMAP参数介绍 sqlmap的使用方式:python sqlmap.py [options]: sqlmap中一共有以下十六个选项卡: 帮助选项卡: Target(目标选项卡): Request ...
- Unity定制 Image、Text的对象生成
2016.4.14 昨天看到 雨凇的 Unity3D研究院之UGUI一个优化效率小技巧: http://www.xuanyusong.com/archives/4006 完好了他所说的代码: usi ...
- Mongodb副本集+分片集群环境部署
前面详细介绍了mongodb的副本集和分片的原理,这里就不赘述了.下面记录Mongodb副本集+分片集群环境部署过程: MongoDB Sharding Cluster,需要三种角色: Shard S ...
- python gzip压缩
1 import urllib2 2 from StringIO import StringIO 3 import gzip 4 5 def loadData(url): 6 request = ur ...
- Chromatix
1.Lens Rolloff Correction 透镜衰减矫正 The Lens Rolloff correction takes into account the fact that,with ...
- ECSHOP删除云服务
一.删除[云服务中心]删除/admin/cloud.php删除/admin/templates/menu.htm中以下代码 Ajax.call('cloud.php?is_ajax=1>act= ...
- 2017.4.26 慕课网--Java 高并发秒杀API配置文件(持续更新)
新建项目,new maven project. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&q ...
- 搭建elsticsearch集群 报错with the same id but is a different node instance解决办法
搭建elsticsearch集群 报错with the same id but is a different node instance解决办法 学习了:https://blog.csdn.net/q ...
- [Functional Programming] Transition State based on Existing State using the State ADT (liftState, composeK)
While sometimes outside input can have influence on how a given stateful transaction transitions, th ...
- JNI 函数注册与管理
class<--> 一一对应so-->method 每个so对应于一个类对象 类中的每个native方法对应 于so中的一个native的function,对应关系涉及 {c ...