开发者

custom compare method in objective c

开发者 https://www.devze.com 2022-12-31 05:54 出处:网络
I\'m trying to use a custom compare method (for use with sortedArrayUsingSelector:) and on another website I got that the format is:

I'm trying to use a custom compare method (for use with sortedArrayUsingSelector:) and on another website I got that the format is:

-(NSComparisonResult) orderByName:(id)otherobject {

That's all very well and good, except how do I compare the otherObject to anything as there's only one thing passed to the method?

Like how does the NSString开发者_运维知识库 method of compare: compare 2 strings when only one string is passed?


The comparison is always between otherObject and self.

0

精彩评论

暂无评论...
验证码 换一张
取 消