I need with one button to change text color, but not once, i need that the button at first press change text in black, at the second press change text in blue, at the third… and more and more.
For change color i use these function
- (IBAction)SwitchColor:(id)sender{
timerLabel.textColor = [UIColor greenColor];
}
But i am too newbie to understand how make what i need.
For the image i use these:
- (IBAction)SwitchImages:(id)sender{
fondo.tag++;
[fondo setImage:[UIImage imageNamed:[NSString stringWithFormat:@"Background%d.jpg",1+(fondo.tag%5)]]];
}
Why don’t you do something like:
In reality, I wouldn’t use
tagfor that though, nor for theSwitchImagesmethod you’ve shown. I would have two local variables which are initialised to0inviewDidLoadand then use those in each of the switch methods to work out what to do next and then increment the variable. Presumably you’ll also want to wrap back round to0at some point as well.