无论是爱还是恨,你都需要单例。实际上每个iOS或Mac OS应用都至少会有UIApplication或NSApplication.什么是单例呢?Wikipedia是如此定义的:在软件工程中,单例是一种用于实现单例的数学概念,即将类的实例化限制成仅一个对象的设计模式。或者我的理解是:单例是一种类,该类...
分类:
其他好文 时间:
2015-04-16 13:51:16
阅读次数:
143
- (void)cutGloable { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ UIGraphicsBegin...
分类:
移动开发 时间:
2015-04-16 13:50:02
阅读次数:
154
iOS开发多线程篇—GCD介绍一、简单介绍1.什么是GCD?全称是Grand Central Dispatch,可译为“牛逼的中枢调度器”纯C语言,提供了非常多强大的函数2.GCD的优势GCD是苹果公司为多核的并行运算提出的解决方案GCD会自动利用更多的CPU内核(比如双核、四核)GCD会自动管理线...
分类:
移动开发 时间:
2015-04-16 12:14:11
阅读次数:
201
同步,不具备开启线程的能力:dispatch_sync异步,具备开启线程的能力:dispatch_async并列队列:多个任务可以同时执行串行队列:一个任务执行完后,再执行下一个任务一个金典的列子:#define ZHGlobalQueue dispatch_get_global_queue(DIS...
分类:
移动开发 时间:
2015-04-16 12:08:10
阅读次数:
125
最近对Queue和dispatch在任务执行中起的作用有些疑问,google了一下,网址如下:http://amattn.com/p/grand_central_dispatch_gcd_summary_syntax_best_practices.html总结就是,Queue决定任务是串行还是并行执...
分类:
其他好文 时间:
2015-04-14 19:21:09
阅读次数:
102
rand Central Dispatch (GCD)是Apple开发的一个多核编程的解决方法。
dispatch queue分成以下三种:
1)运行在主线程的Main queue,通过dispatch_get_main_queue获取。
/*!
* @function dispatch_get_main_queue
*
* @abstract
* Returns the d...
分类:
移动开发 时间:
2015-04-14 11:19:45
阅读次数:
172
方法一 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//写要发生的代码;2秒以后发生
});方法二 [self performSelector: withObject: af...
分类:
移动开发 时间:
2015-04-13 20:51:42
阅读次数:
153
在这里,会用到win32com模块模块下载地址:http://sourceforge.net/projects/pywin32/files/pywin32/代码如下:import win32comfrom win32com.client import Dispatch, constantsppt =...
分类:
编程语言 时间:
2015-04-13 18:45:07
阅读次数:
182
//清除缓存 - (void)clear { ? ? dispatch_async( ?? ? ? ? ? ? ? ? ? dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) ?? ? ? ? ? ? ? ? ? , ^{ ?? ? ? ? ? ? ? ...
分类:
移动开发 时间:
2015-04-11 13:25:47
阅读次数:
153
一,什么是GCD? GCD (Grand Center Dispatch),宏大(牛逼)的中央调度。Apple开发的一个多核编程的解决方法。在iOS所有实现多线程的方案中(NSThread,NSOperation&NSOperationQueue、GCD),GCD应该是最有魅力的,因为GCD本身是....
分类:
编程语言 时间:
2015-04-09 19:35:29
阅读次数:
142