I am currently working with the iPhone SDK.
I have an NSTimer that changes the background image of a UIButton. Once this is completed, it will again launch the same action (reset NSTimer) for a certain number of times.
My problem is if my NSTimer is configured to run more than once per second. (0.75, say) The background image will not change.
I use NSLog to verify that the event is firing. But the button image will remain in its original state.
Is there a way to change the background image more than once per second?
This is my timer:
[NSTimer scheduledTimerWithTimeInterval: tmpLvlSpeed target: self selector: @selector(simPressRed:) userInfo: nil repeats: NO];
And the code to change the image:
[btnRed setImage:[UIImage imageNamed:@"btn_red.png"] forState:UIControlStateNormal];
if tmpLvlSpeed ββis less than 1.0, the button image will never change. Despite the fact that the simPressRed function still works.
Any clues? Is it possible to change the update cycle?
source share