本文介绍了多维NSArray对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以创建二维NSArray而不以原始格式aFloatArray [] []嵌套数组.
Is there a way to create two dimensional NSArray without nesting arrays in the primitive format aFloatArray[][].
谢谢.
推荐答案
不幸的是没有.创建多维NSArray:
Unfortunately not. To create a multi-dimensional NSArray:
NSArray *multiArray = [NSArray arrayWithObjects:
[NSMutableArray array],
[NSMutableArray array],
[NSMutableArray array],
[NSMutableArray array], nil];
// Add a value
[[multiArray objectAtIndex:1] addObject:@"foo"];
// get the value
NSString *value = [[multiArray objectAtIndex:1] objectAtIndex:0];
但是,您可以在Objective-C中使用C代码(因为它是C的严格超集),如果适合您,您可以按照建议的方式声明数组.
However, you can use C code in Objective-C (since it is a strict superset of C), if it fits your need you could declare the array as you had suggested.
这篇关于多维NSArray对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!