Sorting NSArray and returning NSArray?

后端 未结 3 1445
一向
一向 2021-01-21 10:01

I am just looking at sorting an NSArray of NSNumbers into numeric order but am a little unsure of the best way to go. By my way of thinking 001 and 002

3条回答
  •  执笔经年
    2021-01-21 10:12

    You don't need a mutable array at all. You can just do:

    NSArray* sortedArray = [arrayNumbers sortedArrayUsingSelector:@selector(compare:)];
    

提交回复
热议问题