copy can only be used if the nscoping protocol is extended
General NSString NSMutebleString NSArray NSMutebleArray NSDictionary NSMutebleDictionary NSSet NSMutebleSet These capabilities The former is read-only and the latter can be modified read-only -> read-only 只读 -> 只读
a b Shallow copy The address is the same. Read-only. Make a copy. In fact, there is no need to create a new object when executing retain
Read-only-> Modifiable Use mutablecopy🎜Modifiable-> Modifiable Use mutablecopy🎜Modifiable-> Read-only Use copy🎜These are deep copies that will create objects🎜
🎜Is your NSarray read-only copy or read-only, so it is a shallow copy🎜
copy can only be used if the nscoping protocol is extended
General
NSString NSMutebleString
NSArray NSMutebleArray
NSDictionary NSMutebleDictionary
NSSet NSMutebleSet
These capabilities
The former is read-only and the latter can be modified
read-only -> read-only
只读 -> 只读
a b
浅拷贝
地址一样的 只读 复制一份 其实执行的retain 没必要创建新对象
a b只读 -> 可修改
用mutablecopy可修改 -> 可修改
用mutablecopy可修改 -> 只读
用copy这些都是
深拷贝
rrreeeShallow copy
The address is the same. Read-only. Make a copy. In fact, there is no need to create a new object when executing retainRead-only-> Modifiable
Use mutablecopy🎜Modifiable-> Modifiable
Use mutablecopy🎜Modifiable-> Read-only
Use copy🎜These aredeep copies
that will create objects🎜 🎜Is your NSarray read-only copy or read-only, so it is a shallow copy🎜