How to sort numbers in NSArray?

前端 未结 5 852
深忆病人
深忆病人 2021-02-03 11:55

I can\'t piece together how to do this.

I fetch my array from a plist, this array is full of numbers (as set in the plist). Now al I need to do is sort them so they are

5条回答
  •  后悔当初
    2021-02-03 12:37

    Try this code?

     NSArray *array = /* loaded from file */;
     array = [array sortedArrayUsingSelector: @selector(compare:)];
    

提交回复
热议问题