目标C - 排序字符串数组 [英] Objective C - Sort an array of string

查看:96
本文介绍了目标C - 排序字符串数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有由这是一个字符串对象的属性进行排序的对象的阵列。
我怎样才能做到这一点?


解决方案

您需要使用

   -  [NSArray的sortedArrayUsingSelector:]

- [NSMutableArray的sortUsingSelector:] 并通过 @selector(比较:)作为参数。<​​/ P。 >

这里的答案链接
日期字符串的排序的NSArray或对象

I have to sort an array of objects by a property of the objects that is a string. How can I do this?

解决方案

you need to use

-[NSArray sortedArrayUsingSelector:]

or

-[NSMutableArray sortUsingSelector:] and pass @selector(compare:) as the parameter.

here's a link to the answer Sort NSArray of date strings or objects

这篇关于目标C - 排序字符串数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆