NSMutableArray count method show the NSMutableArray is count 0?
- by Tattat
This is my init method:
-(id)init{
self = [super init];
magicNumber = 8;
myMagicArray = [[NSMutableArray alloc] initWithCapacity:(magicNumber*magicNumber)];
NSLog(@"this is the magic Array: %d", [myMagicArray count]);
return self;
}
This is the .h:
@interface Magic : NSObject {
NSMutableArray *myMagicArray;
int magicNumber;
}
The console shows me that number is 0. instead of 64, wt's happen? I already check out this post:
StackOverflow Link: http://stackoverflow.com/questions/633699/nsmutablearray-count-always-returns-zero