目标c中的自定义比较方法

时间:2010-05-24 20:05:15

标签: objective-c methods compare

我正在尝试使用自定义比较方法(与sortedArrayUsingSelector:一起使用),而在另一个网站上我得到的格式为:

-(NSComparisonResult) orderByName:(id)otherobject {

这一切都非常好,除了如何将otherObject与任何东西进行比较,因为只有一件事传递给方法?

比如NSString compare:方法在只传递一个字符串时如何比较2个字符串?

1 个答案:

答案 0 :(得分:4)

比较始终在otherObjectself之间。