页: 1 我想将阵列与<条码>IntiveCompare方法区分开来。
这是我撰写的法典:
names= [names sortedArrayUsingComparator: ^ NSComparisonResult (id obj1, id obj2)
{
return [obj1 caseInsensitiveCompare: obj2];
}];
The problem is that sortedArrayUsingComparator
returns a NSArray instead of a NSMutableArray, and I get a warning and problems at runtime with this code.
Is there is a way to cast the NSArray to a NSMutableArray? Or do I have to copy all of the elements? This last solution is expensive: could someone suggest a nice, low overhead solution?