ABPersonViewController
未在可编辑模式下打开。当我使用断点时,控制不会到达委托(delegate)方法。哪里有问题?这是我的代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Fetch the address book if ((people != nil) && [people count]) { ABAddressBookRef addressBook = ABAddressBookCreate(); //ABPersonViewController *personController = [[ABPersonViewController alloc] initWithNibName:@"ABPersonViewController" bundle:nil]; ABRecordRef person = (ABRecordRef)[people objectAtIndex:indexPath.row]; ABPersonViewController *personController = [[[ABPersonViewController alloc] init]autorelease]; personController.addressBook = addressBook; personController.personViewDelegate = self; personController.displayedPerson = person; personController.allowsEditing = YES; //navigationController = [[UINavigationController alloc] init] ; [self presentModalViewController:personController animated:YES]; //[self.navigationController pushViewController:personController animated:YES]; //[personController release]; } else { // Show an alert if "KETAN" is not in Contacts UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not find naina in the Contacts application" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; [alert release]; } [people release]; } - (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue { return NO; }
最佳答案
关于可编辑模式,您的方向是正确的。但是,您首先需要从导航 Controller 推送 ABPersonViewController
(参见 documentation)
关于ios - ABPersonViewController 未以可编辑模式打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6226860/