iOS数组排序
[_fields sortUsingComparator:^NSComparisonResult(UITextField *obj1, UITextField *obj2) {
/* NSOrderedAscending = -1L, // 右边的对象排后面 NSOrderedSame, // 一样 NSOrderedDescending // 左边的对象排后面 */
CGFloat obj1Y = obj1.frame.origin.y; CGFloat obj2Y = obj2.frame.origin.y;
if (obj1Y > obj2Y) { // obj1排后面
return NSOrderedDescending; }
else { // obj1排前面
return NSOrderedAscending; } }];