Difference between NSArray and NSMutableArray

后端 未结 3 1310
孤街浪徒
孤街浪徒 2021-01-30 20:11

What is the difference b/w NSArray and NSMutableArray?

相关标签:
3条回答
  • 2021-01-30 20:26

    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.

    0 讨论(0)
  • 2021-01-30 20:38

    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..

    0 讨论(0)
  • 2021-01-30 20:40

    The "mutable" types are classes which can be changed after they've been initialized, like NSMutableString vs NSString.

    0 讨论(0)
提交回复
热议问题