0

I can not understand why navigation bar is not going to add any button other than cancel button in Following code this kind of thing done in Viber application so it is possible

 ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController     alloc] init];
picker.navigationBar.tintColor=[UIColor colorWithRed:91.0/256.0 green:72.0/256.0 blue:110.0/256.0 alpha:1.0];
//picker.navigationController.navigationBar.topItem.rightBarButtonItem = nil;
[picker.navigationBar setHidden:NO];
picker.peoplePickerDelegate = self;
// Display only a person's phone, email, and birthdate
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty], 
                           [NSNumber numberWithInt:kABPersonEmailProperty],
                           [NSNumber numberWithInt:kABPersonBirthdayProperty], nil];

//picker.navigationBarHidden=TRUE;
picker.displayedProperties = displayedItems;
//UIBarButtonItem *addbutton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(AddContact)];          
   //   picker.navigationController.navigationBar.topItem.rightBarButtonItem = addbutton;

[self presentModalViewController:picker animated:NO];
[picker release];
//[addbutton release];

can anybody help please

NIKHIL
  • 2,725
  • 1
  • 24
  • 49

2 Answers2

3

refer this article it demonstrates how to add custom button on ABPeoplePickerNavigationController

Maulik
  • 19,108
  • 14
  • 80
  • 136
2

i can show you how to add custom button to navigation bar. Use this code if this is helpful,

UIImage *buttonImage = [UIImage imageNamed:@"Done.png"];

    UIButton *aButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];

    [aButton setImage:buttonImage forState:UIControlStateNormal];

    aButton.frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height);

    UIBarButtonItem *aBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:aButton];

    [aButtonaddTarget:selfaction:@selector(navigatehome)forControlEvents:UIControlEventTouchUpInside];

    self.navigationItem.rightBarButtonItem = aBarButtonItem;

    [aBarButtonItem release];
Sameera Chathuranga
  • 3,486
  • 1
  • 25
  • 46