你需要做的 -
- (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.
}
}
嘿,當我這樣做時,我得到的警告「'UIImageView'可能不會響應'秋天:'和應用程序凍結循環運行時。有任何想法嗎? –
是的,它會的。因爲方法是視圖控制器,如果你用圖像對象調用它,它肯定會失敗。早些時候我認爲圖像是一些控制器名稱。檢查已編輯的帖子。 – rishi