title: Help with setTitle on iOS
body: <p>I am a rookie with programming.  I have entered in the following code and the app runs without bugs but crashes when the button is pressed.  The goal is to identify if the button is pressed once or twice.  If it is pressed a third time, it should reset to never being pressed.</p>
  
  <p>buttonTestViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface buttonTestViewController : UIViewController {
  }
  
  -(IBAction)pressButton:(id)sender;
  
  @end
  </code></pre>
  
  <p>buttonTestViewController.m</p>
  
  <pre><code>@implementation buttonTestViewController
  
  
  -(IBAction)pressButton:(id)sender{
  static int counter;
  
  if (counter == 0) {
      [sender setTitle:@"not answered"];
  }else if (counter == 1) {
      [sender setTitle:@"Pressed Once"];
  }else if (counter == 2) {
      [sender setTitle:@"Pressed Twice"];
  }
  counter += 1;
  
  if (counter &gt; 2) {
      counter = 0;
  }
  }
  - (void)dealloc {
  [super dealloc];
  }
  
  @end
  </code></pre>
  
  <p>I would also like to change the background color of the button when pressed and I continue to get errors if I use setBackgroundColor.  Thank you in advance for your time and consideration.</p>