object-c 数组排序!!!求助!!! 高手在哪里 我创建得stu1 stu2 stu3 stu4 stu5 里都有学生姓名 性别 数学成绩 然后把他们都放到数组里NSArray *array = [[NSArray alloc] initWithObjects:stu1,stu2,stu3,stu4,stu5,nil];我想按照数学成绩排序 应该怎么运用下面得方法啊 怎么修改啊NSArray * sortArray =[array sortedArrayUsingSelector:@selector(compare:)]; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 -(NSComparisonResult) compare:(stu*) other { if (⋯⋯) { return NSOrderedDescending; }else if (⋯⋯) { return NSOrderedAscending; }⋯⋯ 其实和冒泡排序差不多嘛,你比较一下stu.math,然后冒泡,就可以搞定了 iphone技术交流群,4633616,欢迎加入探讨。 Ipad 开发 图片信息保存 oc为什么有两种调用方法的方式? IOS前景 怎么应用iOS 5推出最新的通知中心(notification center)? developer.apple.com的登陆 搞iphone开发,感觉力不从心 ios本地通知,如何立即通知 UIWebView怎么拦截到网页里面JS发起的Ajax请求 iOS项目移植 tabBar 点击index =1 的时候怎样让它还是index = 0 关于ipad本地保存数据 tabbar controller 怎样增加一个选项?
-(NSComparisonResult) compare:(stu*) other {
if (⋯⋯) {
return NSOrderedDescending;
}else if (⋯⋯) {
return NSOrderedAscending;
}
⋯⋯