一、performSelector调用和直接调用区别下面两段代码都在主线程中运行,我们在看别人代码时会发现有时会直接调用,有时会利用performSelector调用,今天看到有人在问这个问题,我便做一下总结, [delegate imageDownloader:self didFinishWith
分类:
其他好文 时间:
2016-03-03 11:25:52
阅读次数:
171
方法1:performSelector [self performSelector:(SEL) withObject:(id) afterDelay:(NSTimeInterval)] --SEL 调用哪个方法 --id 参数 --NSTimeInterval 延时时间 方法2:NSTimer NS
分类:
其他好文 时间:
2016-02-18 22:43:50
阅读次数:
148
[self performSelector:@selector(stopLoading) withObject:nil afterDelay:2.0] 此方法表示,会在2s后调用stopLoading方法 参考:http://www.cnblogs.com/buro79xxd/archive/201
分类:
其他好文 时间:
2016-02-17 18:50:54
阅读次数:
125
self performSelector: withObject: afterDelay:延迟事件再推出viewcontroller时要注意//取消所有延迟事件 [NSObject cancelPreviousPerformRequestsWithTarget:self];
分类:
其他好文 时间:
2016-01-26 20:17:02
阅读次数:
138
二,何时使用Run Loop 对于辅助线程,在需要和线程有更多交互时,才使用Run Loop。比如:1)使用端口或者自定义输入源来和其他线程通讯 2)使用线程定时器 3)Cocoa中使用任何performSelector...的方法(参考Table:Performing selectors on o...
分类:
移动开发 时间:
2016-01-24 00:23:17
阅读次数:
185
1.延迟执行1.1.perform...// 3秒后自动回到当前线程调用 self 的 download: 方法,并且传递参数:@“http://xxx.jpg”[self performSelector:@selector(download:)withObject:@"http://xxx.jpg...
分类:
其他好文 时间:
2016-01-18 10:34:53
阅读次数:
121
1、performSelector 一旦定制好延时任务,不会卡住当前线程//2秒后再调用self的run方法[self performSelector:@selector(run) withObject:nil afterDelay:2.0];2、使用GCD函数// 该方法中, 会根据传入的队列来决...
分类:
其他好文 时间:
2016-01-06 23:23:40
阅读次数:
178
本文列举了四种延时执行某函数的方法及其一些区别。假如延时1秒时间执行下面的方法。- (void)delayMethod { NSLog(@"execute"); }1.performSelector方法[self performSelector:@selector(delayMethod) with...
分类:
移动开发 时间:
2016-01-02 12:07:33
阅读次数:
178
浅谈iOS开发中方法延迟执行的几种方式字数668 阅读118 评论0 喜欢0 Method1. performSelector方法Method2. NSTimer定时器Method3. NSThread线程的sleepMethod4. GCD公用延迟执行方法- (void)delayMethod{ ...
分类:
其他好文 时间:
2015-12-26 15:10:55
阅读次数:
196
1.响应方法Bool isInstace = [p respondsTosesector:@selector(run)];// 没有参数-(id) performSelector:selector(应用selector指定的方法) NSObject的方法// 一个参数-(id) performSel...
分类:
其他好文 时间:
2015-12-25 01:11:22
阅读次数:
360