Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I retrieve an integer value from an NSMutableArray on the iPhone?

How would I get an integer value out of an NSMutableArray?

like image 546
Rahul Vyas Avatar asked Jun 02 '09 13:06

Rahul Vyas


1 Answers

You'll need to use NSNumber:

myArray = [NSMutableArray array];
[myArray addObject:[NSNumber numberWithInteger:1234]];

//..

int theNumber = [[myArray objectAtIndex:0] integerValue];
like image 139
e.James Avatar answered Sep 19 '22 14:09

e.James