Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set an ABPeoplePickerNavigationController's prompt?

This is the code I'm using to call the people picker, but the prompt label text doesn't change:

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];
like image 568
mverzilli Avatar asked Jan 19 '26 10:01

mverzilli


2 Answers

There is a key piece of information missing in the other answers, and not quite obvious. You need to set the prompt after the line:

[self presentModalViewController:picker animated:YES];

So, if you do it like this, it works:

[self presentModalViewController:picker animated:YES];
picker.navigationBar.topItem.prompt = @"Choose a contact to...";
like image 178
Johan Kool Avatar answered Jan 22 '26 18:01

Johan Kool


You can change the title with:

picker.navigationBar.topItem.title = @"iPhone Contacts";

And you can change the prompt with:

picker.navigationBar.topItem.prompt = @"iPhone Contacts";
like image 24
Brad Avatar answered Jan 22 '26 16:01

Brad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!