title: Remove cancel button in ABPeoplePickerNavigationController. Strange behavior in iOs 4.x
body: <p>I would like to remove the cancel button in the navigation bar of ABPeoplePickerNavigationController because I want to have an add button.
  I customized the navigation controller delegate in this way:</p>
  
  <pre><code>- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
  
  
  switch ([navigationController.viewControllers count]) {
  
      case 0: {
  
          viewController.navigationItem.rightBarButtonItem = nil;
          break;
  
      }
  
      case 1: {
  
          viewController.navigationItem.rightBarButtonItem = nil;
          break;
      }
  
      case 2: {
  
  
  
          UIBarButtonItem *addButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPerson:)];
          [viewController.navigationItem setRightBarButtonItem:addButtonItem animated:NO];
          [addButtonItem release];
  
  
  
          UIBarButtonItem *cancelButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
          [viewController.navigationItem setLeftBarButtonItem:cancelButtonItem animated:NO];
          [cancelButtonItem release];
  
  
  
          NSLog(@"View 2 %@",viewController.navigationItem.rightBarButtonItem);
  
  
          break;
      }
      case 3: {
  
               UIBarButtonItem *editButtonItem;
  
               if ([viewController isKindOfClass:[ABPersonViewController class]]) {    
  
                      editButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editPerson:)];
                      self.personView  = (ABPersonViewController*) viewController;
                      self.personView.allowsEditing = YES;
                      self.personView.personViewDelegate = self;
                      [viewController.navigationItem setRightBarButtonItem:editButtonItem animated:NO];
                      [editButtonItem release];
  
              } else {
           // ABPersonNewViewController
          //No need to add codes here
              }  
  
             break;
      }
  
      default: {
  
  
  
  
          break;
      }
  
  }
  </code></pre>
  
  <p>It works fine in iOs 3.x and iOs 5.x, but in iOS 4.x I always have the cancel button in the navigation bar when the contacts list appears but if I select a contact then I go back to the first view controller the add button will appear.</p>
  
  <p>How can explain this strange behavior only in iOS 4.x ?</p>