我正在遍历这样的二维数组:
for (menuViewController *aSelection in mainDataArray) {
...
}
但是,如何访问较低数组的数据?以下代码不起作用,但让您了解我的意思:
for (menuViewController *aSelection in mainDataArray) {
NSLog(@"Data: %@", [aSelection objectAtIndex:2]);
}
我正在遍历这样的二维数组:
for (menuViewController *aSelection in mainDataArray) {
...
}
但是,如何访问较低数组的数据?以下代码不起作用,但让您了解我的意思:
for (menuViewController *aSelection in mainDataArray) {
NSLog(@"Data: %@", [aSelection objectAtIndex:2]);
}
如果要遍历数组中的数组,可以试试下面的方法吗?
for (NSArray* aSelection in mainDataArray) {
NSLog(@"Data: %@", [aSelection objectAtIndex:2]);
}
你为什么不做第二个 for-in 语句
for (NSArray* aSelection in mainDataArray) {
for (NSArray* bSelection in aSelection) {
//Do something innovative :)
}
}