Objective-C中NSMutable***与NS***的转

2019-03-22  本文已影响0人  超哥__

NSMultableDictionary NSDictionary
NSMultableArray NSArray

所有对象都继承NSObject,而NSObject存在copy,mutableCopy两个函数,分别返回该对象的非mutable拷贝和multable拷贝

NSMultableDictionary 转 NSDictionary [[dic copy] autorelease]
NSDictionary 转 NSMultableDictionary [[dic mutableCopy] autorelease]
NSMultableArray 转 NSArray [[arr copy] autorelease]
NSArray 转 NSMultableArray [[arr multableCopy] autorelease]

上一篇下一篇

猜你喜欢

热点阅读