please tell me that can we create an array of imteger in objective c i am a new iphone programmer and i am creating an aray which can take an integer from a view (at 0th position)and pass that array to next view and then again put an integer to it (at 1st position) and so on.... please help because it does not accept integer value
2 Answers
You can only store objects in NSArrays, not primitives (like int, float, NSInteger, etc.), which is probably what you're trying. Use NSNumber instead.
2 Comments
Ranjeet Sajwan
but if i use NSNumber *myInt = [NSNumber numberWithInt:sender.tag]; [myarray addObject:myInt]; it show null on oth position of my array i have already declared my array no compilation problen is there......
Shaggy Frog
You'll have to rephrase your question. I am having trouble understanding. If you are trying to add objects to an
NSArray after initialization, that will not work, as it is not a mutable class. You will want to use NSMutableArray instead.