objective c - Differences between [NSArray arrayWithArray:] and [NSArray copy] -
lately work much arrays , i'm wonder.. what's diffrences between 2 lines.
nsarray *array = [nsarray arraywitharray:somearray];
and
nsarray *array = [somearray copy];
which of faster? in case have nsmutablearray
, mutablecopy
?
which of faster?
don't worry it. premature optimization.
the main difference: first approach results in autoreleased "copy" don't own , don't have release, while own object created on sec line. both arrays immutable, way.
objective-c cocoa-touch cocoa nsmutablearray nsarray
No comments:
Post a Comment