如果属性是copy、retain的话是等价的。如下: - (void)setXXX:(NSString*)axx { if (_xxx != axx) { [_xxx release]; _xxx = [axx copy]; } } 拆分下就知道了, 将nil代入(即axx) 对nil进行retain/copy返回仍然是nil 所以,等价。 转:http://www.cocoachina.com/ask/questions/show/94713 相关文章: 2022-12-23 2022-12-23 2022-12-23 2022-12-23 2021-11-02 2021-06-24 2022-02-23 2022-12-23