2011-09-26 121 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獲得所需數據。