1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

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

Discussion in 'Mac Programming' started by xiaohuli170, Apr 13, 2009.

  1. macrumors newbie

    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 ,button 2 , button 11 , button 111, but I found that these object can add the array by thhis order: button 1 , button 11,button 111 , button 2.why ? Thank you for your answer!
  2. macrumors 68040


    Are you sorting before you insert or inserting then sorting? The issue is that a lexicographical sort instead of a numeric sort on the second "token". You should have options on sorting this differently. What are you using to sort now?

  3. macrumors 6502a

    You can add items to an array in whatever order you like.

    If you post the code you used to add these items, someone can point out why it didn't work as you expected.

Share This Page