title: Keeping UIButton highlighted
body: <p>Hey!
  I have a xib file were i would like a round rect button to stay highlighted after it is pressed. I also would like to have a different button that is pressed after the first one that takes you to the next page. How can I do this. Some code would be greatly appreciated!</p>
  
  <p>This is my .h:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface Test1ViewController : UIViewController {
  
      IBOutlet UIButton *button1;
      IBOutlet UIButton *button2; 
  
  
  }
  
  -(IBAction) buttonPressed:(id)sender;
  -(IBAction) secondButtonPressed:(id)sender;
  - (void)flipButton;
  
  
  @end
  </code></pre>
  
  <p>This is my .m:</p>
  
  <pre><code>#import "Test1ViewController.h"
  #import "Page2.h"
  
  @implementation Test1ViewController
  
  -(IBAction)buttonPressed:(id)sender
  {
      [self performSelector:@selector(flipButton) withObject:nil afterDelay:0.0];
  }
  
  - (IBAction)secondButtonPressed {
      if ( button1.selected ) {
  
          Page2 *page2 = [[Page2 alloc] initWithNibName:@"Page2" bundle:nil];
          page2.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
          [self presentModalViewController:page2 animated:YES];
          [page2 release];
  
      }
  }
  
  
  
  
  /*
  // The designated initializer. Override to perform setup that is required before the view is loaded.
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
          // Custom initialization
      }
      return self;
  }
  */
  
  /*
  // Implement loadView to create a view hierarchy programmatically, without using a nib.
  - (void)loadView {
  }
  */
  
  
  /*
  // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
  - (void)viewDidLoad {
      [super viewDidLoad];
  }
  */
  
  
  /*
  // Override to allow orientations other than the default portrait orientation.
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  */
  
  - (void)flipButton {
      if ( button1.selected ) {
          button1.highlighted = NO;
          button1.selected = NO;
      } else {
          button2.highlighted = YES;
          button2.selected = YES;
      }
  }
  
  - (void)didReceiveMemoryWarning {
      // Releases the view if it doesn't have a superview.
      [super didReceiveMemoryWarning];
  
      // Release any cached data, images, etc that aren't in use.
  }
  
  - (void)viewDidUnload {
      // Release any retained subviews of the main view.
      // e.g. self.myOutlet = nil;
  }
  
  
  - (void)dealloc {
      [super dealloc];
  }
  
  @end
  </code></pre>
  
  <p>Thanks a lot for all the help!</p>