title: How to change Title of UIBarButtonItem when button is clicked - iPhone
body: <p>I'm trying to change the title of UIBarButtonItem when button is clicked.  Here's the code that I have... but it doesn't work.</p>
  
  <pre><code>UIBarButtonItem * btnleft1 = [[UIBarButtonItem alloc] initWithTitle:@"Test2" 
                                                        style:UIBarButtonItemStyleDone 
                                                        target:self
                                                        action:@selector(TestingThis:)];
  
  self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:btn, btnleft, btnleft1, nil];
  
  - (void)TestingThis:(id)sender {
      if (self.navigationItem.rightBarButtonItem.title == @"Test2") {
          self.navigationItem.rightBarButtonItem.title = @"Done";
      }
      else
      {
          self.navigationItem.rightBarButtonItem.title = @"Test2";
      }
  }
  </code></pre>
  
  <p>So that's the code that I'm using.  Please keep in mind that button "btnleft1" is in rightBarButtonItem"S" and not in rightBarButtonItem.  If i change it to rightbarbuttonitems.title... it gives me an error.</p>