How to make an iPhone button highlight (hold state)
Here’s how to use iPhone SDK to make a button hold it’s on/highlighted state when you click on it:
- (IBAction)badButton:sender; {
badButton.highlighted = YES;
if( _hasChosen == NO ) {
_hasChosen = YES;
[NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(badButton:) userInfo:nil repeats:NO];
}
}
On simulator it looks perfect, but on device there’s a brief moment when it goes white before it goes blue/highlighted again.