2010-09-09 12 views
0

Je vais avoir du mal à obtenir ce code pour définir l'invite:Définition d'une invite dans un ABPeoplePickerNavigationController

// Create a PeoplePicker 
ABPeoplePickerNavigationController *objPeoplePicker = [[ABPeoplePickerNavigationController alloc] init]; 
[objPeoplePicker setPeoplePickerDelegate:self]; 

// Customize colors 
objPeoplePicker.topViewController.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.294 green:0.278 blue:0.247 alpha:1.0]; 
objPeoplePicker.topViewController.searchDisplayController.searchBar.tintColor = [UIColor colorWithRed:0.294 green:0.278 blue:0.247 alpha:1.0]; 

// Only display phone numbers 
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty], nil]; 
objPeoplePicker.displayedProperties = displayedItems; 

// Add a prompt 
objPeoplePicker.navigationBar.topItem.prompt = @"Choose a contact to..."; 

// Show the picker 
[self presentModalViewController:objPeoplePicker animated:YES]; 

La section « Ajouter une invite » ne semble pas être mise à l'invite. Des idées? Voici une capture d'écran de la sortie:

alt text

Répondre

0

La pièce maîtresse de l'information à cette question, et pas tout à fait évident, est que vous devez définir l'rapide après la ligne:

[self presentModalViewController:objPeoplePicker animated:YES]; 

Donc, si vous le faites comme ça, cela fonctionne:

[self presentModalViewController:objPeoplePicker animated:YES]; 
objPeoplePicker.navigationBar.topItem.prompt = @"Choose a contact to..."; 
+0

A travaillé sans faille! Merci! –