strong

82 阅读1分钟

@property(strong) NSString: str

self.str = new(0) self.str = new(1)

objc_storestrong(*location, obj) { id previous = *location if previous = obj return -> 如果不变 return

objc_retain(obj) -> 先retain新的obj new(1) 引用计数 + 1 *location = obj -> 把新的obj new(1) 赋值给 指针 self.str objc_release(previous) -> 原来的obj new(0) 引用计数 - 1

}