Iphone 在ABPeoplePickerNavigationController中设置提示
我无法让此代码设置提示:Iphone 在ABPeoplePickerNavigationController中设置提示,iphone,objective-c,cocoa-touch,abpeoplepickerview,Iphone,Objective C,Cocoa Touch,Abpeoplepickerview,我无法让此代码设置提示: // Create a PeoplePicker ABPeoplePickerNavigationController *objPeoplePicker = [[ABPeoplePickerNavigationController alloc] init]; [objPeoplePicker setPeoplePickerDelegate:self]; // Customize colors objPeoplePicker.topViewController.navi
// 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];
“添加提示”部分似乎没有设置提示。有什么想法吗?以下是输出的屏幕截图:
这个问题的关键信息(不是很明显)是需要在行后设置提示:
[self presentModalViewController:objPeoplePicker animated:YES];
所以,如果你这样做,它会起作用:
[self presentModalViewController:objPeoplePicker animated:YES];
objPeoplePicker.navigationBar.topItem.prompt = @"Choose a contact to...";