Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
NSArray is immutable, so you can't stick anything anywhere. You could come up with something using arrayWithObject and arrayByAddingObjectsFromArray.

-Lee
 
NSArray is immutable. So can't be done.

If you mean an NSMutableArray, then:
1. Read the class reference doc.
2. Look for a method that will insert an object at a particular index. (hint: underlined words are clues)

Before posting, always consult the documentation.
 
NSArray is immutable, so you can't stick anything anywhere. You could come up with something using arrayWithObject and arrayByAddingObjectsFromArray.

-Lee

Thanks Lee,

but what i mean i this !

i have a NSArray, each element is a string value, i want to add a string before all the strings in my array. is there any function to do that ? or i should do that manually?
 
Thanks Lee,

but what i mean i this !

i have a NSArray, each element is a string value, i want to add a string before all the strings in my array. is there any function to do that ? or i should do that manually?

NSArray is immutable. Do you know what "immutable" means? It means "can't be changed". Since the NSArray can't be changed, you can't insert anything, you can' remove anything, and you can't change any value already stored there.

If you want a mutable array, you must use NSMutableArray.
 
Thanks Lee,

but what i mean i this !

i have a NSArray, each element is a string value, i want to add a string before all the strings in my array. is there any function to do that ? or i should do that manually?

"Before all strings" means: Your array contains "A", "B", "C" and you want an array containing "X", "A", "B", "C".

"Before each string" means: Your array contains "A", "B", "C" and you want an array containing "XA", "XB", "XC".

Which one is it? If it is the second, why does it matter that the string are in an array?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.