Apple具有一个很好的综合小例子,“QuickContacts”(developer.apple.com/library/IOs/samplecode/QuickContacts/Introduction/Intro.html),概述了Address Book UI Framework的基本用法。 - 可下载的源代码按照描述的方式工作(一旦将一个名为“Appleseed”的人添加到您的地址簿或将第246行(QuickContactsViewController.m)中的人名更改为您的地址簿中已存在的人员)。iOS7 - ABPersonViewController,编辑模式
问: 我们怎样才能修改功能-(void)showPersonViewController
功能以这样的方式使ABPersonViewController "picker"
已经在编辑模式(带有明显的“完成” editingButton),打开时(被推到navigationController的后堆栈)。
在“7”之前的iOS版本中,这是一个直截了当的问题,只需插入例如“ picker.editing = YES;
,然后将选取器推入导航堆栈,以便在编辑模式下看到它,一旦它打开(请参阅下面的代码)。
在iOS7中,这不起作用。
这是iOS7中的一个错误吗?如果是这样,是否有一个简单的解决方法(而不是如逆向工程ABPersonViewController
类)? - 或者现在需要以不同的方式进行编码?
期待您的意见。
-(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的错误。 http://bugreport.apple.com –
@ Tommie C. - 你说得对,苹果证实这是一个错误。 - 谢谢你的评论。 – user2831473
这看起来还没有被修复? – SAHM