title: how to change uibutton title at runtime in objective c?
body: <p>I know this question is asked many a times,and i am also implementing the same funda for chanding the title of the uibutton i guess.</p>
  
  <p>Let me clarify my problem first. I have one uibutton named btnType, on clicking of what one picker pops up and after selecting one value,i am hitting done button to hide the picker and at the same time i am changing the the title of the uibutton with code</p>
  
  <pre><code>[btnType setTitle:btnTitle forState:UIControlEventTouchUpInside];
  [btnType setTitleColor:[UIColor redColor] forState:UIControlEventAllEvents];
  </code></pre>
  
  <p>But with my surpriaze,it is not changed and application crashes with signal EXC_BAD_ACCESS. I am not getting where i am making mistake.I have allocated memory to the btnType at viewdidLoad. Also I am using </p>
  
  <pre><code>-(IBAction)pressAddType
  {
      toolBar.hidden = FALSE;
      dateTypePicker.hidden = FALSE;
  }
  </code></pre>
  
  <p>event on pressing the button to open the picker. Also i would like to mention that i have made connection with IB with event TouchUpInside for pressAddType.</p>
  
  <p>Any guesses? I will be grateful if you could help me.
  Thanks.</p>
  
  <p>UPDATE:</p>
  
  <pre><code>@interface AddSettingPage : UIViewController&lt;UITextFieldDelegate&gt;
  {
      IBOutlet UIButton *btnType;
      NSString *btnTitle;
  }
  @property (nonatomic, retain) IBOutlet UIButton *btnType;
  -(IBAction)pressAddType;//:(id)sender;
  </code></pre>
  
  <p>Also </p>
  
  <pre><code>@synthesize btnType,btnTitle;
  </code></pre>