【发布时间】:2015-08-21 21:56:03
【问题描述】:
我想找到一种方法,如果用户在ABPeoplePickerNavigationController 中按下“取消”按钮(我不相信可以将其删除),视图控制器要么不会关闭,或将自动重新打开。
例如,给定以下内容:
var picker = ABPeoplePickerNavigationController()
picker.peoplePickerDelegate = self
self.presentViewController(picker, animated: true, completion: nil)
我希望能够做类似的事情:
if (self.presentedViewController != picker && !userContinuedPastPicker) {
//where userContinuedPastPicker is a boolean set to false
//in a delegate method called when the user clicks on an a contact
//(meaning the user didn't press the cancel button but instead clicked on a contact)
//create and present a UIAlertAction informing the user they must select a contact
//present picker again
self.presentViewController(picker, animated: true, completion: nil)
}
这不起作用;但是,因为if 语句在用户按下取消按钮或按下联系人之前不会“等待”。
【问题讨论】:
标签: ios swift uinavigationcontroller abaddressbook presentviewcontroller