【发布时间】:2010-01-18 19:34:14
【问题描述】:
我正在尝试更改多维数组中的值,但出现编译器错误:
warning: passing argument 2 of 'setValue:forKey:' makes pointer from integer without a cast
这是我的内容数组:
NSArray *tableContent = [[NSArray alloc] initWithObjects:
[[NSArray alloc] initWithObjects:@"a",@"b",@"c",nil],
[[NSArray alloc] initWithObjects:@"d",@"e",@"f",nil],
[[NSArray alloc] initWithObjects:@"g",@"h",@"i",nil],
nil];
这就是我尝试更改值的方式:
[[tableContent objectAtIndex:0] setValue:@"new value" forKey:1];
解决方案:
[[tableContent objectAtIndex:0] setValue:@"new val" forKey:@"1"];
所以数组键是一个字符串类型 - 有点奇怪但很高兴知道。
【问题讨论】:
标签: objective-c arrays multidimensional-array