title: objective c NSString comparision
body: <p>I have three button named(titled) hello, nothing, heaven and one label (IBOutlet UIlabel lab). I want to display three diff messages for three diff button click. But the following code failed to accomplish this. Can anyone suggest any idea?</p>
  
  <pre><code>-(IBAction)buttonclick:(id)sender  
  {  
  
      NSString *title=[sender titleForState:UIControlStateNormal];
  
      if([title isEqualToString:@"hello"])
      {
  
          NSString *str=[[NSString alloc] initWithFormat:@"abc"];
      }
      else if([title isEqualToString:@"nothing"]) {
  
          NSString *str=[[NSString alloc] initWithFormat:@"def"];
      }
      else if([title isEqualToString:@"heaven"])
      {
  
          NSString *str=[[NSString alloc] initWithFormat:@"ijk"];
      }   
  
      lab.text=str;
      [str release];
  }
  </code></pre>
  
  <p>output:  </p>
  
  <pre><code>warning:unused variable str;  
  </code></pre>