views:

37

answers:

1

I try to access some values in a NSMutableArray I created, but I only get some numbers (address?) if I try to access them.

I was able to initialize an array and can add and change objects with

[myNSMutableArray addObject:[NSNumber numberWithInt:10]]

and

[myNSMutableArray replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:47]

I also can print the value at index [0] with

NSLog(@"%@", [myNSMutableArray objectAtIndex:0]);

and I get 47 as expected.

But how can I access the integer value of the object in the array so I can save it tomyIntValue?

+3  A: 
int myIntValue = [[myNSMutableArray objectAtIndex:0] intValue];

Just have a look at the NSNumber class reference

MKroehnert
Thanks a lot!Just what I was looking for!
Daniel