2010-09-09 26 views
0

我无法得到这个代码来设置提示设置提示:在的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]; 

“添加提示”一节似乎并没有被设置的提示。有任何想法吗?下面是一个输出的截图:

alt text

回答

0

的关键信息到这个问题,并没有很明显的,就是你需要设置提示后线:

[self presentModalViewController:objPeoplePicker animated:YES]; 

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

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

工作完美无瑕!谢谢! – 2010-10-12 15:34:04

相关问题