我正在尝试使用自定义比较方法(与sortedArrayUsingSelector:
一起使用),而在另一个网站上我得到的格式为:
-(NSComparisonResult) orderByName:(id)otherobject {
这一切都非常好,除了如何将otherObject
与任何东西进行比较,因为只有一件事传递给方法?
比如NSString
compare:
方法在只传递一个字符串时如何比较2个字符串?
答案 0 :(得分:4)
比较始终在otherObject
和self
之间。