docs: 内容

This commit is contained in:
杭城小刘
2020-11-08 15:51:47 +08:00
parent a744b950b0
commit e89fe0ca1c
27 changed files with 11290 additions and 10341 deletions

21
Chapter1 - iOS/1.89.md Normal file
View File

@@ -0,0 +1,21 @@
# block 原理
1. 解决循环引用不应该使用 weakself而是使用 strong-weak
```Objective-c
__weak typeof(self) Weakself = self;
self.block = ^ {
__strong typeof(Weakself) Strongself = Weakself;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ {
NSLog(@"%@", Strongself.name);
});
};
self.block();
```
![image-20200810214301251](/Users/lbp/Library/Application Support/typora-user-images/image-20200810214301251.png)
字节对齐k值8的倍数。
字节对齐的原因: