2011-09-26 117 views
1

我只想检索所有地址簿联系人并在UITableView中显示。地址簿+ UITableView索引iPhone

显示图像中显示的所有联系人。

我不知道该怎么做。

enter image description here

请建议我来解决这个问题。

在此先感谢...

回答

-1

是啊,我得到了解决......

使用此代码

// creating the picker 
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; 
// place the delegate of the picker to the controll 
picker.peoplePickerDelegate = self; 

// showing the picker 
[self presentModalViewController:picker animated:NO]; 
// releasing 
[picker release]; 

,它会显示来自iPhone的所有联系人,如图figure..but不显示在模拟器类型来看..你必须在设备运行...

编码快乐......

2

你frined是ABAddressBookhttp://developer.apple.com/library/mac/#documentation/UserExperience/Reference/AddressBook/Classes/ABAddressBook_Class/Reference/Reference.html(NSArray *)people返回你的所有联系人。 您可以使用它作为表格的来源。 我没有完整的示例代码,但我认为这不是Stack Overflow的要点。在这里搜索以找到如何实施UITableView

+0

其实我知道如何做到这一点,但不知道如何从iPhone –

+0

所有联系人作为I W死记硬背:ABAddressBook为您提供实例方法“people”,它返回给您一组联系人。 – Krumelur

0

Here是您正在寻找的解决方案。在这种情况下,您将从方法- (void)collectContacts获得所需数据。