像这样是非原子的COPY的Setter
@property (copy, nonatomic) NSString *someString;
-(void)setSomeString:(NSString *)someString {
_someString = someString;
_someString = [someString copy];
}
像这样我想知道强,弱和分配
的setter和getter@property (copy, atomic) NSString *someString; // Setter ?
@property (Strong, nonatomic) NSString *someString;
@property (assign, nonatomic) NSString *someString;
@property (Strong, atomic) NSString *someString;
@property (assign, atomic) NSString *someString;
答案 0 :(得分:1)
Ex:setter方法
- (void)setImgView:(UIImageView *)imgView{
if (_imgView == imgView) {
return;
}
_imgView = imgView;
_imgView.layer.borderColor = [UIColor clearColor].CGColor;
_imgView.layer.borderWidth = 0.0f;
_imgView.layer.cornerRadius = _imgView.frame.size.width/2;
}