如何设置ABPeoplePickerNavigationController的提示?

mve*_*lli 3 iphone cocoa-touch objective-c addressbook

这是我用来调用人员选择器的代码,但提示标签文本不会改变:

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
picker.displayedProperties = [NSArray arrayWithObjects: [NSNumber numberWithInt:kABPersonEmailProperty], nil];  

picker.navigationItem.prompt = @"Choose a contact to...";

[self presentModalViewController:picker animated:YES];
Run Code Online (Sandbox Code Playgroud)

Joh*_*ool 6

其他答案中缺少一条关键信息,并不是很明显.您需要在行设置提示:

[self presentModalViewController:picker animated:YES];
Run Code Online (Sandbox Code Playgroud)

所以,如果你这样做,它的工作原理:

[self presentModalViewController:picker animated:YES];
picker.navigationBar.topItem.prompt = @"Choose a contact to...";
Run Code Online (Sandbox Code Playgroud)