0
나는 ABPeoplePickerNavigationController이 있으며 연락처 페이지 (이미지보기)의 BACK 단추를 연락처 목록에 추가하려고합니다.ABPeoplePicker에서 사람 세부 정보를 다시 연락처 목록으로 되돌리려면?
나는 그것을 발견하고 고정 - 내 대답의 코드에 필요한 사람에 대한 답을.
나는 ABPeoplePickerNavigationController이 있으며 연락처 페이지 (이미지보기)의 BACK 단추를 연락처 목록에 추가하려고합니다.ABPeoplePicker에서 사람 세부 정보를 다시 연락처 목록으로 되돌리려면?
나는 그것을 발견하고 고정 - 내 대답의 코드에 필요한 사람에 대한 답을.
- (void)inviteFromAddresBook{
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
// Display only a person's phone, email, and birthdate
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty],
[NSNumber numberWithInt:kABPersonEmailProperty], nil];
picker.displayedProperties = displayedItems;
// Show the picker
[self presentModalViewController:picker animated:YES];
}
#pragma mark ABPeoplePickerNavigationControllerDelegate methods
// Displays the information of a selected person
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
return YES;
}
// Does not allow users to perform default actions such as dialing a phone number, when they select a person property.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
if (property == kABPersonPhoneProperty) {
ABMultiValueRef phone = ABRecordCopyValue(person, property);
CFStringRef selectedNumber = ABMultiValueCopyValueAtIndex(phone, identifier);
//NSLog(@"selected Number: %@",selectedNumber);
smsPicker = [[MFMessageComposeViewController alloc] init];
smsPicker.messageComposeDelegate = self;
smsPicker.recipients = [NSArray arrayWithObjects:[NSString stringWithFormat:@"%@",selectedNumber], nil];
smsPicker.body = globalParams.inviteSMS;
[[smsPicker navigationBar]setBackgroundImage:[UIImage imageNamed:@"Nav_clean"] forBarMetrics:UIBarMetricsDefault];
[smsPicker.navigationController setDelegate:self];
}
else if(property == kABPersonEmailProperty){
ABMultiValueRef email = ABRecordCopyValue(person, property);
CFStringRef emailAddress = ABMultiValueCopyValueAtIndex(email, identifier);
NSString *urlString = mailto:[email protected]?subject=New&body=TestNew;
NSURL *mailURL = [NSURL URLWithString: urlString];
[[UIApplication sharedApplication] openURL: mailURL];
}
[self dismissModalViewControllerAnimated:YES];
return NO;
}
// Dismisses the people picker and shows the application when users tap Cancel.
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker;{
[self dismissModalViewControllerAnimated:YES];
}