.m文件
NSInteger priceCompare(id obj1, id obj2, void *context) {
float price1 = [[obj1 objectForKey: @"minprice"] floatValue];
float price2 = [[obj2 objectForKey: @"minprice"] floatValue];
if (price1 < price2)
return NSOrderedAscending;
else if (price1 > price2)
return NSOrderedDescending;
else
return NSOrderedSame;
}
.h文 件
NSMutableArray *sortedArray =(NSMutableArray *)[_flightInfoDataSource sortedArrayUsingFunction: priceCompare context: NULL]
本文详细介绍了如何使用Objective-C语言进行iOS应用开发,包括基本语法、开发环境配置、常见框架使用及实战案例分析。
775

被折叠的 条评论
为什么被折叠?



