【发布时间】:2013-09-30 16:20:59
【问题描述】:
Apple 提供了一个很好的综合性小示例,“QuickContacts”(developer.apple.com/library/IOs/samplecode/QuickContacts/Introduction/Intro.html),概述了Address Book UI Framework 的基本用法。 - 可下载的源代码按描述工作(一旦您将一个名为“Appleseed”的人添加到您的地址簿或将第 246 行(QuickContactsViewController.m)中的人名更改为您的地址簿中已经存在的名称)。
问题:
我们如何修改函数-(void)showPersonViewController 函数,使ABPersonViewController "picker" 在打开时(被推到navigationController 的堆栈后)已经处于编辑模式(带有可见的“完成”编辑按钮)。
在“7”之前的 iOS 版本中,直接插入例如picker.editing = YES; 在将选择器推送到导航堆栈之前,以便在打开后在编辑模式下查看它(参见下面的代码)。
在 iOS7 中,这不再起作用了。
这是 iOS7 中的错误,如果是,是否有简单的解决方法(而不是例如逆向工程 ABPersonViewController 类)? - 或者现在需要以不同的方式编码?
期待你们的cmets。
-(void)showPersonViewController
{
// Search for the person named "Appleseed" in the address book
NSArray *people = (NSArray *)CFBridgingRelease(ABAddressBookCopyPeopleWithName(self.addressBook, CFSTR("Appleseed")));
// Display "Appleseed" information if found in the address book
if ((people != nil) && [people count])
{
ABRecordRef person = (__bridge ABRecordRef)[people objectAtIndex:0];
ABPersonViewController *picker = [[ABPersonViewController alloc] init];
picker.personViewDelegate = self;
picker.displayedPerson = person;
// Allow users to edit the person’s information
picker.allowsEditing = YES;
picker.editing = YES; // in iOS6 this works, in iOS7 it does not
[self.navigationController pushViewController:picker animated:YES];
}
...
...
}
【问题讨论】:
-
这是 iOS 7 中的一个错误。报告的人越多,修复的优先级越高。 bugreport.apple.com
-
@ Tommie C. - 你是对的,Apple 确认这是一个错误。 - 感谢您的评论。
-
这似乎还没有修复??
标签: ios ios7 addressbook abpersonviewcontroller