i have a question:
I designed my GUI without the InterfaceBuilder,
now i want change the image of a button for a short period of time,
but it won’t change, until the whole for-loop has finished.
What am i doing wrong?
for (size_t i=0; i< 100; ++i){
switch (variable) {
case 0:
[self changeRedButtonToWhite: redButton];
break;
case 1:
....
}
}
-(IBAction) changeRedButtonToWhite: (id)sender{
[sender setBackgroundImage: whiteImage forState: UIControlStateNormal];
}
You can’t use a for loop to do this, you should try using an NSTimer instead. The UI isn’t refreshed while there is a loop going on inside the main thread.