for ( tempI = 0; tempI < 10; tempI++ )
{
tempJ = 1;
NSArray *objectsForArray = [NSArray arrayWithObjects:@"array[tempI][tempJ]", @"array[tempI][tempJ+1]", @"array[tempI][tempJ+2]", nil];
}
Run Code Online (Sandbox Code Playgroud)
我可以像上面那样编写代码吗?我需要存储的浮点值(array[][])在NSArray.我可以做吗 ?
我的问题是,我有一个矩阵作为
1.0 0.4 0.3 0.5
2.0 0.4 0.5 0.5
3.0 4.3 4.9 0.5
Run Code Online (Sandbox Code Playgroud)
我需要使用1.0,2.0 3.0检索值(0.4,0.3,0.5).我怎样才能使用NSDictionary?
谢谢
for( tempI = 0; tempI < 5; tempI++)
{
NSDictionary *dictionary[tempI] = [ [NSDictionary alloc] initWithObjects:@"array[tempI][tempI + 1]", @"array[tempI][tempI + 2]", @"array[tempI][tempI + 3]", @"array[tempI][tempI + 4]", @"array[tempI][tempI + 5]", nil];
}
Run Code Online (Sandbox Code Playgroud)
我可以这样写吗?Objective C是否接受它?
我收到错误了 …