检测 ViewController 是否被释放:
- (void)dealloc{
NSLog(@"dealloc this ViewController ");
}
注意如果使用了 block
,而且 block
中引用了 self
,会导致 ViewController 退出后,不被释放;
需将用到 self
的地方改为 __weak __typeof(&*self)weakSelf = self
中的 weakSelf
。
import Foundation | |
extension Data { | |
init?(hexString: String) { | |
let len = hexString.count / 2 | |
var data = Data(capacity: len) | |
for i in 0..<len { | |
let j = hexString.index(hexString.startIndex, offsetBy: i*2) | |
let k = hexString.index(j, offsetBy: 2) | |
let bytes = hexString[j..<k] |
检测 ViewController 是否被释放:
- (void)dealloc{
NSLog(@"dealloc this ViewController ");
}
注意如果使用了 block
,而且 block
中引用了 self
,会导致 ViewController 退出后,不被释放;
需将用到 self
的地方改为 __weak __typeof(&*self)weakSelf = self
中的 weakSelf
。
A list of Sketch plugins hosted at GitHub, in no particular order.