已经有很多关于 NSMutableArray 排序的问题仍然无法找到我的问题的确切解决方案。请跟进:
我有一个像这样的arrMasterArray:
//This is an array of dictionaries with each element having dictionary at its index and key-value for the same.
<__NSArrayM 0x8bbaca0>(
{
"Brand_Description" = Accolate;
"Medication_DateStart" = "5/5/2012 12:00:00 AM";
},{
"Brand_Description" =Trisenox;
"Medication_DateStart" = "5/5/2012 12:00:00 AM";
}, {
"Brand_Description" = Ultiva;
"Medication_DateStart" = "5/5/2012 12:00:00 AM";
} ,{
"Brand_Description" = Accretropin;
"Medication_DateStart" = "5/5/2012 12:00:00 AM";
}
我在arrMasterArray上应用排序,它返回一个排序数组,但只有该特定 keyPath 的元素:
NSArray *arrNameCompare= [[arrMasterArray valueForKeyPath:@"Brand_Description"] sortedArrayUsingSelector:@selector(compare:)];
输出如下内容:
<__NSArrayI 0x10e0efb0>( Accolate, Accretropin, Trisenox, Ultiva )
现在我希望arrMasterArray根据**arrNameCompare**
.
我搜索了很多,但没有运气。感谢您的耐心和对不起我的英语。再次感谢。