Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old Apr 13, 2009, 10:07 PM   #1
macrumors newbie
Join Date: Jan 2009
How to add these object with name to the array by this order?

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!
xiaohuli170 is offline   0 Reply With Quote
Old Apr 13, 2009, 10:15 PM   #2
macrumors 68040
lee1210's Avatar
Join Date: Jan 2005
Location: Dallas, TX
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?

lee1210 is offline   0 Reply With Quote
Old Apr 13, 2009, 10:16 PM   #3
macrumors 6502a
Join Date: Oct 2006
Location: Virginia
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.
eddietr is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: How do I convert an NSData object to an NSDictionary object, and vice versa? moonman239 iPhone/iPad Programming 6 May 2, 2014 01:17 PM
How do I add a key/value pair to an AVQueuePlayer object? moonman239 iPhone/iPad Programming 0 Feb 10, 2014 07:46 PM
Apple should make a method that returns an array's object that satisfies a predicate. moonman239 iPhone/iPad Programming 5 Nov 21, 2013 07:21 PM
Object in array is being skipped moonman239 iPhone/iPad Programming 12 Sep 7, 2013 01:59 PM
How can I take a random object from one array, and insert to another? **Help** iJustinCabral iPhone/iPad Programming 18 Aug 22, 2012 11:25 AM

Forum Jump

All times are GMT -5. The time now is 02:51 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC