我正在加载 ABPeoplePickerNavigationController
。单击人员选择器中的联系人时,我正在检查条件
if([navigationController isKindOfClass:[ABPeoplePickerNavigationController class]]
&& [viewController isKindOfClass:[ABPersonViewController class]]){
//Statements
}
但在 IOS 7 中我注意到,第二个条件,即
[viewController isKindOfClass:[ABPersonViewController class]
始终返回NO。我知道加载的 View Controller 是 ABPersonViewController
。
在 IOS 6 之前,这已经/正在正常工作。可能是什么问题?无论如何我可以解决这个问题吗?
编辑:
在 UINavigationController
Delegate 中检查条件
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
并且 viewController 类在登录时显示为 ABContactViewController
。
最佳答案
当检查你的类时,你会发现 iOS7 返回了不同的类型。
检查您需要检查的逻辑。您不必通过内省(introspection)来对人员选择器操作做出适当的 react 。只需实现 ABPeoplePickerNavigationControllerDelegate 中的标准委托(delegate)方法即可。特别是,您必须实现:
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person;
关于iphone - 检查当前 viewController 类是否为 IOS 7 中的 Person ViewController 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19181482/