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

    Joined:
    Jan 13, 2009
    #1
    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

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    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?

    -Lee
     
  3. macrumors 6502a

    Joined:
    Oct 29, 2006
    Location:
    Virginia
    #3
    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