Storing integer values in array?

Discussion in 'Public Game Developers Forum' started by kohjingyu, Jul 31, 2009.

  1. kohjingyu

    kohjingyu Well-Known Member

    Mar 20, 2009
    1,770
    0
    0
    Student/Developer
    Singapore
    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.
     
  2. slipster216@gmail.com

    slipster216@gmail.com Active Member

    Mar 11, 2009
    39
    0
    0
    Game Developer
    Boston, mass
    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..
     
  3. kohjingyu

    kohjingyu Well-Known Member

    Mar 20, 2009
    1,770
    0
    0
    Student/Developer
    Singapore
    Could you give me an example?

    Thanks.
     
  4. ChaoticBox

    ChaoticBox Well-Known Member

    Oct 8, 2008
    877
    5
    18
    Male
    Developer
    Toronto Canada
    If you're just storing numbers use plain C arrays and be happy.
     

Share This Page