我的数组:
NSMutableArray *squareLocations;
CGPoint dotOne = CGPointMake(1, 1);
[squareLocations addObject:[NSValue valueWithCGPoint:dotOne]];
CGPoint dotTwo = CGPointMake(10, 10);
[squareLocations addObject:[NSValue valueWithCGPoint:dotTwo]];
CGPoint dotThree = CGPointMake(100, 100);
[squareLocations addObject:[NSValue valueWithCGPoint:dotThree]];
int num = [squareLocations count];
for (int i = 0; i < num; i++)
{
NSValue *pointLocation = [squareLocations objectAtIndex:i];
NSLog(@"%@", pointLocation);
}
当我询问squareLoctions
对象计数时,它返回零?但就在上面要求计数时,我添加了三个 NSValue 对象???有人有想法么?