Home

How to make an iPhone button highlight (hold state)

Posted on February 05, 2009 at 07:26 PM

Categories: code, iphone

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.

Browse Old Articles

Categories:

Popular posts:

Subscribe to:

Blogroll: