mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-24 20:00:37 +00:00
docs: 内容
This commit is contained in:
@@ -105,6 +105,26 @@ UITableView 在滚动的时候一个优化点之一就是 UIImageView 的显示
|
||||
|
||||
注意:添加 Observer 是没有效果的。
|
||||
|
||||
注意:直接添加的 Mach Port 后线程确实是常驻线程,但是如果需要让线程停止,`[runLoop run]` 方法不能满足。
|
||||
`[runLoop runMode:NSDefualtRunLoopMode beforeDate:[NSDate distantFuture]];`
|
||||
设计可以停止的常驻线程
|
||||
|
||||
```Objective-C
|
||||
@property (assign, nonmatioc) BOOL shouldStopRun;
|
||||
|
||||
self.shouldStopRun = NO;
|
||||
|
||||
- (void) start {
|
||||
while(!shouldStopRun && [runLoop runMode:NSDefualtRunLoopMode beforeDate:[NSDate distantFuture]]);
|
||||
}
|
||||
|
||||
- (void)removeSourceOrTimer {
|
||||
self.shouldStopRun = YES;
|
||||
CFRunLoopStop(CFRunLoopGetCurrent()); // RunLoop 源代码里面一直循环的条件,得来的停止条件
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## 自动释放池
|
||||
|
||||
自动释放池什么时候创建和释放
|
||||
|
||||
Reference in New Issue
Block a user