您可以創建一個UIBarButton並將其添加到像這樣的ABPeoplePickerNavigationController的UINavigationBar。
peoplePicker.topViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPerson:)];
-(IBAction)addPerson:(id)sender{
ABNewPersonViewController *view = [[ABNewPersonViewController alloc] init];
view.newPersonViewDelegate = self;
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:view];
[self.picker presentModalViewController:nc animated:YES];
}
,我碰到了問題是,的ABPeoplePickerNavigationController具有放置在rightBarButtonItem插槽取消按鈕,我不得不更新的
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
導航欄我已經記錄了整個過程我的blog與worked example,應該允許你創建一個類似於iPhone上的聯繫人風格的應用程序。希望這可以幫助。
你錯過了「[peoplePicker發佈];」在你的(buttonIndex == 0) – Meltemi 2009-08-12 17:41:02