我想做这样的事情:
for (v=1;v=150;v++) {
for (h=1; h=250;v++) {
tile_0%i_0%i.image = [UIImage imageWithData:tmp_content_of_tile]; //1st %i = v; 2nd %i = h
}
}
在 %i 中应该插入当前值“v”还是“h”?是否可以?怎么称呼?
最佳答案
它被称为数组,在基本的 C/C++ 中看起来像这样:
Tile tile[150][250];
for (int v=0;v<150;v++) {
for (int h=0; h<250;v++) {
tile[v][h].image = [UIImage imageWithData:tmp_content_of_tile];
}
}
另请查看 for 循环的语法。
关于c++ - 代码 : How to address dynamic Variables?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2522041/