ABPeoplePickerNavigationController 在单个 cel 中显示所有联系人数据 [英] ABPeoplePickerNavigationController display all contact data in a single cel

查看:24
本文介绍了ABPeoplePickerNavigationController 在单个 cel 中显示所有联系人数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,当我点击联系人时,它会转到 ABpeoplePicekrNavigationcontroller 并以表格中的列表形式显示所有联系人.但我想选择所有联系人,以便我想执行一些操作.那么怎么办我做到了.

Hi i am developing a app where when i click contacts it goes to ABpeoplePicekrNavigationcontroller and display all contacts in the form of list in the table.But i want to select all contacts so that i want to perform some action.So how can i achive this.

我不确定这是要问的正确问题.实际上,我试图将联系信息发送到下一个屏幕,而不是每次我想选择整个联系人列表时都选择单个联系信息.那么我该怎么做??

I am not sure this is the right question to ask.Actually i am trying to send the contact information to next screen instead of selecting single contact information everytime i want to select whole contact list.So how can i do this??

我想我将它们显示在单个单元格中,即使空间不适合单个单元格.只显示单个单元格,以便选择一个包含所有联系信息的单元格会更好地发送..

I thought i show them to show in single cell even though space doesnt fit in single cell.just show them single cell so that selecting one cell which contains all contact information would be better to send..

那么任何人都可以建议我选择所有联系人列表而不是选择一个联系人的正确方法..我不知道我们是否可以这样做?这是我用于访问联系人列表的以下代码.

So can anyone suggest me right way to select all the contacts list rather than selecting one contact..I donno whether we can do this or not??if so how???if not what is the other way?? Here is the below code where i am using for accessing the contact list.

- (IBAction)configureMyContact:(id)sender {
ABPeoplePickerNavigationController *peoplePicker = [[ABPeoplePickerNavigationController alloc] init];
peoplePicker.peoplePickerDelegate = self;
peoplePicker.navigationBar.topItem.title = NSLocalizedString(@"CHOOSE_CONTACT_TITLE", @"Defining my contact title.");
[self presentModalViewController:peoplePicker animated:YES];
[peoplePicker release];
}


- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
[self dismissModalViewControllerAnimated:YES];
}


- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker 
  shouldContinueAfterSelectingPerson:(ABRecordRef)person {

myContactID = ABRecordGetRecordID(person);
[self refreshMyContactButton];
[self saveMyContactID:myContactID];

[self dismissModalViewControllerAnimated:YES];

return NO;
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker 
  shouldContinueAfterSelectingPerson:(ABRecordRef)person
                            property:(ABPropertyID)property
                          identifier:(ABMultiValueIdentifier)identifier{
return NO;
}

推荐答案

你可以使用这个获取你的记录

You can get your record using this

- (void)getPersonOutOfAddressBook
{    
    ABAddressBookRef addressBook = ABAddressBookCreate();

    if (addressBook != nil)
    {
        NSLog(@"Succesful.");

        NSArray *allContacts = (__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);

        NSUInteger i = 0;
        for (i = 0; i < [allContacts count]; i++)
        {            
            ABRecordRef contactPerson = (__bridge ABRecordRef)allContacts[i];



            NSString *firstName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonFirstNameProperty);

            NSString *lastName =  (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonLastNameProperty);

            ABMultiValueRef mobile=ABRecordCopyValue(contactPerson, kABPersonPhoneProperty);

            for (int k=0;k<ABMultiValueGetCount(mobile); k++)
            {
                NSString *mobileNo = (__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(mobile, k);
            }


            //email
            ABMultiValueRef emails = ABRecordCopyValue(contactPerson, kABPersonEmailProperty);

            NSUInteger j = 0;
            for (j = 0; j < ABMultiValueGetCount(emails); j++)
            {
                NSString *email = (__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(emails, j);
            }

        }
    }
    CFRelease(addressBook);
}

这篇关于ABPeoplePickerNavigationController 在单个 cel 中显示所有联系人数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆