iOS开发中常用的单例

社会主义新天地 提交于 2019-12-01 05:30:45

1、UIApplication(应用程序实例)

获取方式:[UIApplication sharedApplication]

详细:http://www.cnblogs.com/hissia/p/5678518.html

 

2、NSNotificationCenter(消息中心)

获取方式:[NSNotificationCenter defaultCenter]

常用的通知模式

 

3、NSFileManager(文件管理)

获取方式:[NSFileManager defaultManager]

 

4、NSUserDefaults(偏好设置)

获取方式:[NSUserDefaults standardUserDefaults]

详细:http://www.cnblogs.com/hissia/p/5642405.html

 

5、NSURLCache(请求缓存)

获取方式:[NSURLCache sharedURLCache]

 

6、NSHTTPCookieStorage(应用程序cookies池)

获取方式:[NSHTTPCookieStorage sharedHTTPCookieStorage]

 

7、NSURLSession(发送请求时候用的)                

获取方式:[NSURLSession sharedSession]

 

8、UIMenuController(弹出的菜单可以选择,复制,剪切,粘贴的功能)      

获取方式:[UIMenuController sharedMenuController]

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!