2011-06-28 40 views
0

我不明白爲什麼導航條是不會在下面的代碼 這種事情在做加比取消按鈕以外的任何按鈕Viber的應用程序,以便有可能如何自定義欄按鈕項目到位取消添加到導航欄AddressBookUI應用像編輯

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]; 

有誰能夠幫忙,請

回答

4

參考this文章它演示如何添加對ABPeoplePickerNavigationController

自定義按鈕
2

我可以告訴你如何添加自定義按鈕,導航欄。如果這是有幫助的,請使用此代碼,

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];