How to add these object with name to the array by this order?

后端 未结 4 1603
星月不相逢
星月不相逢 2020-12-07 06:28

I have some object with name , just like button 1 , button 2 , button 11 ,button 111 , I want to add this object to a array by this order: button 1 ,butto

4条回答
  •  孤街浪徒
    2020-12-07 07:15

    The same way that if you had files of this name in Finder they would order the same way.

    To get proper ordering you need to name them button 001, button 002, button 011, etc.

    Alternatively, you'll have to write your own sort descriptors.

    See here for NSMutableArray sortUsingSelector: and here for NSSortDescriptor

提交回复
热议问题