Not*_*Car 0 objective-c nsarray ios
我的阵列:
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);
}
Run Code Online (Sandbox Code Playgroud)
当我要求squareLoctions对象计数时,它返回零?但就在上面要求计数我添加了三个NSValue对象??? 有人有主意吗?
您需要首先初始化数组
NSMutableArray *squareLocations = [[NSMutableArray alloc] init];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1215 次 |
| 最近记录: |