简体   繁体   中英

Difference between NSArray and NSMutableArray

b / w NSArrayNSMutableArray什么区别?

NSMutableArray (and all other classes with Mutable in the name) can be modified. So, if you create a plain NSArray , you cannot change its contents later (without recreating it). But if you create an NSMutableArray , you can change it — you'll notice it has methods like -addObject: and -insertObject:atIndex: .

See the documentation for details.

“可变”类型是可以在初始化后更改的类,如NSMutableString vs NSString

NSArray : in NSArray we can not change index.... Means fix array.

NSMutableArray : in NSMutableArray we can change index and also add the value in array at run-time..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM