在 iOS 8 中,以下内容已弃用:
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
现在我们应该使用:
-(void)peoplePickerNavigationController:didSelectPerson:
但此方法会在第一次选择后自动关闭人员选择器,而旧版本不会。我有一个例程,需要将用户选择的每个名称一一记录下来。我可以在每次选择后重新显示人员选择器,但它会从名字开始重新启动联系人列表。
希望我解释正确。有人知道如何防止 peoplepickernavigationcontroller 在 iOS 8 中像在 ios7 中那样自动关闭吗?
最佳答案
在 ABPeoplePickerNavigationController 的文档中,查看 predicateForSelectionOfPerson 的注释。
// Optionally determines if a selected person should be returned to the app (predicate evaluates to TRUE),
// or if the selected person should be displayed (predicate evaluates to FALSE).
// If not set and -peoplePickerNavigationController:didSelectPerson: is implemented the selected person is returned to the app,
// or if not set and -peoplePickerNavigationController:didSelectPerson:identifier: is implemented the selected person is displayed.
//
@property(nonatomic,copy) NSPredicate *predicateForSelectionOfPerson NS_AVAILABLE_IOS(8_0);
所以你需要设置一个谓词为FALSE,如果你想显示选中的人。
if ([picker respondsToSelector:@selector(setPredicateForSelectionOfPerson:)])
{
picker.predicateForSelectionOfPerson = [NSPredicate predicateWithValue:NO];
}
关于ios - 如何防止人们选择器导航 Controller 自动解雇,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25954937/