Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jordan72

macrumors member
Original poster
Nov 23, 2005
88
0
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?

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.?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.