I want to create an instance method that creates several NSNumber instances and then stores their pointers in an NSMutableArray. Is the following implementation an okay way to do this?
I tried out this method. It has no problem allocating. I have no problem accessing my NSNumbers. I'm just not sure this is the best way to do it.
Could I get some input on this? Am I facing potential problems I am unaware of, is there a better way to do this, etc.?
Code:
-createNumber:(int)number
{
NSNumber *x = [NSNumber numberWithInt:number];
[myArray addObject: x];
}
I tried out this method. It has no problem allocating. I have no problem accessing my NSNumbers. I'm just not sure this is the best way to do it.
Could I get some input on this? Am I facing potential problems I am unaware of, is there a better way to do this, etc.?