How do copy and mutableCopy apply to NSArray and NSMutableArray?

前端 未结 8 1801
时光取名叫无心
时光取名叫无心 2020-11-27 10:55

What is the difference between copy and mutableCopy when used on either an NSArray or an NSMutableArray?

This is

8条回答
  •  再見小時候
    2020-11-27 11:25

    You're calling addObject and removeObjectAtIndex on the original array, rather than the new copy of it you've made. Calling copy vs mutableCopy only effects the mutability of the new copy of the object, not the original object.

提交回复
热议问题