2010-09-09 88 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

相關問題