我试图建立一个应用程序,允许用户A)输入一个新的人,或B)从他们的联系人中选择一个人......我的问题是项目B.我简要地阅读了关于加载Modal视图控制器的内容,但是希望有人能够指导我参考教程或文章的方向,专门讨论这种用例场景。iPhone:选择一个联系人并加载到自定义应用程序
是的,我对iPhone应用程序开发也有点新意。
我试图建立一个应用程序,允许用户A)输入一个新的人,或B)从他们的联系人中选择一个人......我的问题是项目B.我简要地阅读了关于加载Modal视图控制器的内容,但是希望有人能够指导我参考教程或文章的方向,专门讨论这种用例场景。iPhone:选择一个联系人并加载到自定义应用程序
是的,我对iPhone应用程序开发也有点新意。
ABPeoplePickerNavigationController *peoplePickerController = [[ABPeoplePickerNavigationController alloc] init]; peoplePickerController.peoplePickerDelegate = self; [self presentModalViewController:peoplePickerController animated:YES]; [peoplePickerController release];
3. And you might want to implement the optional methods as:
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
[self dismissModalViewControllerAnimated:YES];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
NSString *name = (NSString *)ABRecordCopyCompositeName(person);
// do something with name.. and release
[self dismissModalViewControllerAnimated:YES];
return NO;
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
return NO;
}
只是为了更新每个人(和请纠正我,如果我不当要对这个),我发现这个资源:https://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/index.html
是的,谢谢你的回答 - 我发现有人实施了这套完整的方法。 正是我需要的。 – Ixmatus 2009-06-25 21:30:52