摘要: 代码看完后感觉非常优秀http://stackoverflow.com/questions/8085188/ios-perform-action-after-period-of-inactivity-no-user-interaction1.新建 Objective-C 类,继承 UIApplication。2.编辑 .h 如下:#import // 定义应用程序超时时间,单位为分钟,因此我们会在这个数上乘以60,以便折算成秒数。#define kApplicationTimeoutInMinutes 5// 定义通知名称,其真实内容是字符串 "timed out"#def 阅读全文
posted @ 2013-10-31 15:40 菁菁工作室 阅读(589) 评论(0) 推荐(0) 编辑
摘要: 单例模式在iOS开发过程中经常用到,苹果提供过objective c单例的比较官方的写法:static MyGizmoClass *sharedGizmoManager = nil; + (MyGizmoClass*)sharedManager{ @synchronized(self) { if (sharedGizmoManager == nil) { [[self alloc] init]; // assignment not done here } } return sharedGizmoManager;} + (id)... 阅读全文
posted @ 2013-10-31 13:54 菁菁工作室 阅读(290) 评论(0) 推荐(0) 编辑