![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
单例模式
jeffasd
这个作者很懒,什么都没留下…
展开
-
单例模式的七种不同的实现
第一种(懒汉,线程不安全): Java代码 public class Singleton { private static Singleton instance; private Singleton (){} public static Singleton getInstance() { if (instance == nu转载 2015-01-08 13:57:57 · 476 阅读 · 0 评论 -
iOS 中的单例模式
http://www.jianshu.com/p/e535c7575d72 在iOS中有很多单例对象,比如UIApplication,UIScreen等等,那我们自己可以实现单例吗?答案是肯定的,请往下看 ARC中的单例实现 //.h文件 #import @interface Singleton : NSObject //单例方法 +(instancetype)sharedSing转载 2016-07-26 10:20:57 · 553 阅读 · 0 评论 -
iOS 单例写法以及 App生命周期线程
// // NetWorkRequestThread.m // test_nstherad_port_02 // Created by jeffasd on 16/7/25. // Copyright © 2016年 jeffasd. All rights reserved. // 创建一个和app生命周期相同的线程并一直请求发起网络请求 #import "NetWorkRequest原创 2016-07-26 10:23:23 · 1383 阅读 · 0 评论