2009-10-25 2 views
1

이 시도했지만 작동하지 않습니다 사람들 선택기로ABPeoplePickerNavigationController에 leftBarButtonItem을 추가하는 방법은 무엇입니까?

ABPeoplePickerNavigationController * people_picker = [[ABPeoplePickerNavigationController alloc] init]; 

people_picker.peoplePickerDelegate = self; 

self.navigationController.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle: @"send" 
     style: self.navigationController.navigationItem.rightBarButtonItem.style 
     target: self 
     action: @selector(cancelAddressBook)] autorelease]; 

[self.navigationController presentModalViewController: people_picker animated: YES]; 

답변

1

당신이 아니라 당신의 탐색 컨트롤러보다, 그것을 직접 버튼을 추가 할 필요가 모달이다. 이 시도 :

people_picker.navigationBar.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle: @"send" 
    style: self.navigationController.navigationItem.rightBarButtonItem.style 
    target: self 
    action: @selector(cancelAddressBook)] autorelease]; 
+0

보다이 같은 을 그것은해야합니다 peoplePicker.topViewController.navigationItem.leftBarButtonItem = ... –

4

당신은 새로 만든 사람들 피커 컨트롤러의 topViewController의 leftBarButtonItem을 설정해야합니다.

ctrl.topViewController.navigationItem.leftBarButtonItem = ... 
+1

왜이 허용되지 않는 이유는 무엇입니까? – paulrehkugler

관련 문제