title: How to animate a button change in UINavigationBar?
body: <p>I am calling the <code>-(void)setEditing:(BOOL)editing animated:(BOOL)animated</code> method in my code to swap between two buttons on the RHS of my navigation bar.</p>
  
  <pre><code>-(void)setEditing:(BOOL)editing animated:(BOOL)animated {  
    [super setEditing:editing animated:animated];  
  
    // Toggle ‘+’ and ‘Add To Order’ button.    
  
    if( editing ) {
      self.navigationItem.rightBarButtonItem = self.addItemButton;  
    }  
    else {           
      self.navigationItem.rightBarButtonItem = self.addToOrderButton;  
    } 
  }
  </code></pre>
  
  <p>Where <code>self.addItemButton</code> and <code>self.addToOrderButton</code> are ivars containing predefined UIBarButtonItems, setup in <code>awakefromNib</code>.</p>
  
  <p>The button in <code>self.addToOrderButton</code> is significantly wider then the one in <code>self.addItemButton</code>, so I’d like their to be a subtle animation between the two widths when the change in editing state is triggered (by tapping a standard <code>editButtonItem</code> on the LHS of the navigation.</p>
  
  <p>If I surround the whole <code>if:else</code> with <code>[UIView beginAnimations:nil context:NULL];</code> and <code>[UIView commitAnimations];</code> the button change does animate, but with their positions—flying into place individually from the top left—rather than in place and just animating their widths.</p>
  
  <p>How I animate the navigation bar elements so that each individual one (the RHS button, the title) animate in more appropriate, restrained ways?</p>