पता पुस्तिका क्यों नहीं पेश करें और उपयोगकर्ता को ईमेल चुनने और ईमेल करने दें?
अपनी प्रोजेक्ट में एड्रेसबुक और एड्रेसबुकयूआई फ्रेमवर्क जोड़ें। उन्हें अपने .h में आयात करें और प्रोटोकॉल ABPeoplePickerNavigationControllerDelegate जोड़ें।
// call when the user cancel
- (void) peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
[self dismissModalViewControllerAnimated:YES];
}
उपयोगकर्ता संपर्क विवरण में डालने दें:
- (void) chooseContact:(id)sender {
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];
}
आप कई आवश्यक प्रतिनिधि तरीकों एक ईमेल पता और खारिज पता पुस्तिका के लिए लागू:
तब पता पुस्तक फोन
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
return YES;
}
फिर आप ईमेल पते के साथ क्या करते हैं:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
if (property == kABPersonEmailProperty) {
//assumed you have a property email in your class
self.email = (NSString *)ABRecordCopyValue(person, kABPersonEmailProperty);
[self dismissModalViewControllerAnimated:YES];
}
return NO;
}