在外国网站上看到一个用artoolKit做的demo,学习了用gcd创建单列
2014-02-20 15:26
253 查看
外国网站:http://www.raywenderlich.com/42266/augmented-reality-ios-tutorial-location-based
看了下里面的demo,源代码里有个用gcd创建的实例;
于是就百度了下:dispatch_once_t 发现用它来创建单例很方便;
http://bj007.blog.51cto.com/1701577/649413/
+ (PlacesLoader *)sharedInstance {
static PlacesLoader *instance = nil;
staticdispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[PlacesLoader alloc] init];
});
return instance;
}
看了下里面的demo,源代码里有个用gcd创建的实例;
于是就百度了下:dispatch_once_t 发现用它来创建单例很方便;
http://bj007.blog.51cto.com/1701577/649413/
+ (PlacesLoader *)sharedInstance {
static PlacesLoader *instance = nil;
staticdispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[PlacesLoader alloc] init];
});
return instance;
}
相关文章推荐
- 一步步学习SPD2010--第十三章节--管理SP Server环境的Web内容(1)--创建一个发布网站
- 一步步学习SPD2010--第十三章节--管理SP Server环境的Web内容(1)--创建一个发布网站
- 推荐一个WSS学习的好网站:http://wss.collutions.com and Http://www.wssdemo.com,本人决没有做广告的意思,只是觉得上面的东西不错。
- 在外国网站上看到了一个别人做的SQL server管理器的源代码,推荐给大家。
- Silverlight学习(一) 创建Silverlight项目,构建一个简单的Silverlight Demo
- 一步一个脚印学习WCF之一WCF概要(中)之客户端与服务-WCF服务的创建与调用Demo
- 分享一个学习PL/SQL的外国的好网站
- 一个学习编程的demo下载网站
- MCSE 2003学习笔记 十二 创建一个HTTPS网站
- sharepoint 2016 学习系列篇(5)-创建一个应用程序网站
- Spring学习笔记(四) JavaConfig创建Bean与AOP编程相结合的Demo
- 创建一个自己的git学习测试环境!
- 推荐一个学习linux的网站-鳥哥的 Linux 私房菜
- Dll学习一_Dll 创建并动态引用窗体且释放窗体Demo
- Android 通知栏Notification的整合 全面学习 (一个DEMO让你完全了解它)
- WCF学习之旅 创建一个简单的WCF程序
- WCF学习笔记(一)创建一个简单的Demo
- 一个学习Linux 编程命令的好网站
- node.js 学习笔记一:创建一个服务器
- 推荐一个学习VBScript的网站