copy不能修改,strong可以修改,防止字符串被意外修改.demo:
——————————————————code 你要的 demo——————————————————
@property (nonatomic, copy) NSString * copystring;
@property (nonatomic, strong) NSString *strongString;
NSMutableString *string = [NSMutableString stringWithString:@"a"];
self.copystring = string;
self.strongString = string;
[string appendString: @"b"];
NSLog(@"copyString:%@--StrongString:%@",self.copystring, self.strongString); // opyString:a--StrongString:ab
--------------------------------------------------------------------------------------------------------------------------------------------
时间: 2024-10-13 17:32:55