- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要有关 iPhone 的自定义地址簿 (ABPeoplePickerViewController) 的帮助吗?我想要一个包含我所有联系人的数组,只将他们的姓名和号码拉到表格 View 的单元格中以显示。选择几个联系人,打开消息并向他们发送带有自定义消息的文本/短信。
WhatsApp Messenger 是一个很棒的例子,如果您转到“设置”,“告诉 friend ”,然后“消息”..我想要那个样子!
它必须是自定义的,因为我还想要下面的“发送”和“取消”按钮,以及 cell.textLabel 中的名称及其在字幕样式 TableView 中的 cell.detailTextLabel 中的编号。
那么我如何从地址簿中获取他们的详细信息并将其放入我的数组(contactsName、contactsNumber)中?提前致谢!这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [contactsName objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [contactsNumber objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
[self dismissViewControllerAnimated:YES completion:^{ NSLog(@"Message controller has been canceled"); }];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
NSString *name = (__bridge_transfer NSString*)ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *number = (__bridge_transfer NSString*)ABRecordCopyValue(person, kABPersonPhoneProperty);
NSLog(@"Name: %@ Number: %@", name, number);
return NO;
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
return NO;
}
- (void)openSMScontroller {
MFMessageComposeViewController *smsView = [[MFMessageComposeViewController alloc] init];
smsView.messageComposeDelegate = self;
smsView.recipients = [NSArray arrayWithArray:contactsNumber];
smsView.body = @"Check out this awesome app!";
[self presentModalViewController:smsView animated:YES];
}
最佳答案
我的 friend ,你可以通过下面的代码从地址簿中获取你想要的内容。!!!!!
快乐编码!!!!!!
- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
ABMultiValueRef phoneNumbers = ABRecordCopyValue(person, kABPersonPhoneProperty);
ABMultiValueRef addressProperty = ABRecordCopyValue(person, kABPersonAddressProperty);
NSArray *address = (NSArray *)ABMultiValueCopyArrayOfAllValues(addressProperty);
if([address count] > 0)
{
for (NSDictionary *addressDict in address)
{
countrytf.text = [addressDict objectForKey:@"Country"];
streetaddresstf.text = [addressDict objectForKey:@"Street"];
citynametf.text = [addressDict objectForKey:@"City"];
statenametf.text = [addressDict objectForKey:@"State"];
zipcodetf.text = [addressDict objectForKey:@"ZIP"];
}
CFRelease(addressProperty);
}
}
关于iphone - 自定义地址簿 ABPeoplePickerViewController 帮忙吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13817370/
_R = [0] * 5 R = [_R] * 4 num_user = 0 num_item = 0 for i in range(8): s = input().split() f
chrome.tabs.onUpdated.addListener(checkForValidUrl); function checkForValidUrl(tabId, changeInfo, ta
我是一名优秀的程序员,十分优秀!