我在网上找到了一个教程,它扩展了 Apple QuickStart 应用程序,它是基本的通讯簿应用程序,另一个返回第一个电话号码,而不管点击了哪个电话号码。我只想在标签中显示选定的电话号码。标签称为 phoneNumber:
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier{
ABMutableMultiValueRef phoneMulti = ABRecordCopyValue(person, kABPersonPhoneProperty);
NSMutableArray *phones = [[NSMutableArray alloc] init];
int i;
for (i = 0; i < ABMultiValueGetCount(phoneMulti); i++) {
NSString *aPhone = [(NSString*)ABMultiValueCopyValueAtIndex(phoneMulti, i)autorelease];
[phones addObject:aPhone];
}
NSString *mobileNo = [phones objectAtIndex:0];
self.phoneNumber.text = phones;
[self dismissModalViewControllerAnimated:YES];
return NO;
}
如何确保标签是用户选择的标签,而不仅仅是第一个数组条目(或我编码的任何其他数组条目)
谢谢