Ran*_*oms 7 uinavigationcontroller abaddressbook ios presentviewcontroller swift
我想找出一种方法,这样,如果用户按下"取消"按钮(我认为不能删除)ABPeoplePickerNavigationController,视图控制器要么不关闭,要么自动重新打开.
例如,给出以下内容:
var picker = ABPeoplePickerNavigationController()
picker.peoplePickerDelegate = self
self.presentViewController(picker, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我希望能够做到这样的事情:
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)
}
Run Code Online (Sandbox Code Playgroud)
这不起作用; 但是,因为if语句不会"等待",直到用户按下取消按钮或按下联系人.