docs: 样式

This commit is contained in:
LiuBinPeng
2022-02-07 19:29:16 +08:00
parent 50bc85248b
commit d3b2102dc9
4 changed files with 104 additions and 182 deletions

View File

@@ -142,22 +142,28 @@ self.shouldStopRun = NO;
0x1 和 0xa0 是十六进制的数对应十进制为1和160。
参考文章:
http://www.cocoachina.com/ios/20180515/23380.html
http://www.cocoachina.com/ios/20170417/19075.html
https://www.jianshu.com/p/4c38d16a29f1
https://www.cnblogs.com/kenshincui/p/6823841.html
https://juejin.im/entry/599c13bc6fb9a0248926a77d
https://blog.ibireme.com/2015/05/18/runloop/
## RunLoop 空闲时做一些任务
```
- (void)print
{
NSLog(@"test");
}
- (void)viewDidLoad
{
CFRunLoopActivity flags = kCFRunLoopBeforeWaiting;
CFRunLoopObserverRef runloopObserver = CFRunLoopObserverCreateWithHandler(
kCFAllocatorDefault, flags, YES, 0,
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
[self performSelector:@selector(print)
onThread:[NSThread mainThread]
withObject:nil
waitUntilDone:NO
modes:@[ NSDefaultRunLoopMode ]];
});
CFRunLoopAddObserver(CFRunLoopGetCurrent(), runloopObserver, kCFRunLoopDefaultMode);
}
```