1
你好我所見過的蘋果名字爲'QUICK CONTACTS'的例子,這裏是 人視圖控制器的錯誤。這裏總是顯示相同的數據有兩個名字關於iPhone中地址簿的相當有趣的問題
// Fetch the address book
ABAddressBookRef addressBook = ABAddressBookCreate();
// Search for the person named "Appleseed" in the address book
NSArray *people = (NSArray *)ABAddressBookCopyPeopleWithName(addressBook, CFSTR("Appleseed"));
// Display "Appleseed" information if found in the address book
if ((people != nil) && [people count])
{
ABRecordRef person = (ABRecordRef)[*people objectAtIndex:0*];
ABPersonViewController *picker = [[[ABPersonViewController alloc] init] autorelease];
picker.personViewDelegate = self;
picker.displayedPerson = person;
// Allow users to edit the person’s information
picker.allowsEditing = YES;
[self.navigationController pushViewController:picker animated:YES];
}
這裏始終顯示兩個人以同一個名字,我們如何才能消除這種錯誤相同的信息。
什麼錯誤?你不能在'約翰蘋果籽'和'胡果蘋果籽'之間選擇?這是因爲它是一個例子,它應該給你一個* quick *(因此名稱)概述這個視圖控制器。鼓勵您將範例擴展到您的需求。根據你的需要,如果有兩個同名的人,你想要拋出一個錯誤,你想顯示一個選擇器在哪裏你可以選擇一個,或者你可以通過代碼選擇正確的一個。隨你便。 – 2011-02-17 12:21:21
`[* people objectAtIndex:0 *]`??? – justin 2011-02-17 12:24:45