如何在ios中选择显示联系人
我正在制作一个通讯录,现在我想显示我在通讯录中选择的联系人,它应该以蓝色显示如何在ios中选择显示联系人,ios,colors,contacts,addressbook,Ios,Colors,Contacts,Addressbook,我正在制作一个通讯录,现在我想显示我在通讯录中选择的联系人,它应该以蓝色显示 AS LIKE IN IPHONE WE CAN SEE ... 为此,我做了这么多的编码 ABRecordRef person = NULL; NSString *name = nil; if(gPerson == NULL) { person = ABPersonCreate(); name = strReceiversNames; } e
AS LIKE IN IPHONE WE CAN SEE ...
为此,我做了这么多的编码
ABRecordRef person = NULL;
NSString *name = nil;
if(gPerson == NULL)
{
person = ABPersonCreate();
name = strReceiversNames;
}
else
{
person = gPerson;
NSString *fName = (NSString*)ABRecordCopyValue(gPerson, kABPersonFirstNameProperty);
NSString *lName = (NSString*)ABRecordCopyValue(gPerson, kABPersonLastNameProperty);
name = [NSString stringWithFormat:@"%@ %@", fName, lName];
}
CFErrorRef error = NULL;
//UILabel *ContectInfo;
// ContectInfo.text = strPhoneNumber;
// ContectInfo.textColor = [UIColor greenColor];
// set name
ABRecordSetValue(person, kABPersonFirstNameProperty, (CFStringRef)name, &error);
// set phone number
ABMutableMultiValueRef phoneNumber = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(phoneNumber, (CFStringRef)strPhoneNumber, kABPersonPhoneMobileLabel,NULL);
ABRecordSetValue(person, kABPersonPhoneProperty, phoneNumber, &error);
CFRelease(phoneNumber);
if(error != NULL)
{
NSLog(@"Error: %@", error);
}
ABPersonViewController *ctrl = [[ABPersonViewController alloc] init];
在这张单子里,号码是我的联系电话。。
当我点击按钮时,我只想把它显示为蓝色
strPONENUMBER是NSString
提前感谢为什么不使用一个PersonViewController的setHighlightedItemForProperty:with Identifier:方法?或者可能更改displayedPerson属性?希望这能给你一个好的方向。你应该这样使用 选择联系人时使用此选项
ABPersonViewController *ctrl = [[ABPersonViewController alloc] init];
[ctrl setHighlightedItemForProperty:kABPersonPhoneProperty withIdentifier:0];
最后调用这个函数
- (void)setHighlightedItemForProperty:(ABPropertyID)property withIdentifier:(ABMultiValueIdentifier)identifier
{
}
那么现在你从地址簿中选择的蓝色数字是什么呢