我无法获取此代码来设置提示:
// 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];
“添加提示”部分似乎没有设置提示。有任何想法吗?这是输出的屏幕截图:
答案 0 :(得分:0)
这个问题的关键信息,并不是很明显,你需要设置之后的行:
[self presentModalViewController:objPeoplePicker animated:YES];
所以,如果你这样做,它就有效:
[self presentModalViewController:objPeoplePicker animated:YES];
objPeoplePicker.navigationBar.topItem.prompt = @"Choose a contact to...";