你需要做 -
- (void)fall:(int)i {
// manipulate image[i]; separately from the for loop
}
并打电话给 -
- (void)main {
for (int i=0; i <= 100; i++) {
[image fall:i];
}
}
编辑 -
如果你想通过索引 -
- (void)fall:(int)i {
// manipulate image[i]; separately from the for loop
}
并打电话给 -
- (void)main {
for (int i=0; i <= 100; i++) {
[self fall:i]; // Now from here you can either pass index
}
}
如果你想传递一些图像 -
- (void)fall:(UIImage)i {
// manipulate image[i]; separately from the for loop
}
并打电话给 -
- (void)main {
for (int i=0; i <= 100; i++) {
[self fall:imageI]; // Now from here you need to pass image, if that image is stored in array, then fetch from array. Or you need to manipulate in the way in which you are storing.
}
}