★ TouchArcade needs your help. Click here to support us on Patreon.

Storing integer values in array?

07-31-2009, 07:46 AM
#1
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
Storing integer values in array?

Hey guys,
Is there any way to store certain numbers in array then do something like:

Code:
image.center = CGPointMake([integerArray objectAtIndex:0], [integerArray2 objectAtIndex:1]);
Basically I want to retrieve values from an array then set an image view's center to them.

Thanks.
07-31-2009, 08:57 AM
#2
Joined: Mar 2009
Location: Boston, mass
Posts: 39
Yes, if your using an NSMutableArray or NSArray, you'll have to make them NSNumbers instead of ints. Anything stored in an NSArray must inherit from NSObject.

C style arrays can store ints just fine though..

__________________________________
Splat; shoot stuff and make art, what more could you ask for? Currently sporting a 4.78 rating in the app store!
07-31-2009, 09:13 AM
#3
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
Could you give me an example?

Thanks.
07-31-2009, 02:34 PM
#4
Joined: Oct 2008
Location: Toronto Canada
Posts: 863
If you're just storing numbers use plain C arrays and be happy.

SHREDD GO FAST! FREE!
Nozoku Rush Kick Math's Ass!
Critter Panic Break yer brain! FREE!
Silverfish & Silverfish MAX Hardcore arcade insanity!
Nozoku A casual game of math & logic.
More: cbox.me Twitter YouTube