ios - Unwind Segue not being performed after shouldPerformSegueWithIdentifier UIAlertController -
i have unwind segue uiviewcontroller named detailviewcontroller mainviewcontroller defined (within mainviewcontroller):
@ibaction func deleteitemunwind(sender: uistoryboardsegue) { let sourceviewcontroller = sender.sourceviewcontroller } in detailview, have button should perform segue connected scene exit name deleteitemunwindsegue, , in detailviewcontroller have prepareforsegue change value of variables. works fine. problem is, have following code in detailviewcontroller
override func shouldperformseguewithidentifier(identifier: string!, sender: anyobject!) -> bool { if (identifier == "deleteitemunwindsegue") { let deleteitemalert: uialertcontroller = uialertcontroller(title: "delete item", message: "are sure want delete item?", preferredstyle: .actionsheet) let cancelaction: uialertaction = uialertaction(title: "cancel", style: .cancel) { action -> void in return false } deleteitemalert.addaction(cancelaction) let deleteitemaction: uialertaction = uialertaction(title: "yes", style: .destructive) { action -> void in return true } deleteitemalert.addaction(deletechoreaction) self.presentviewcontroller(deleteitemalert, animated: true) { } } return true } and while prepareforsegue code works, unwind segue itself not triggered dismiss view. ideas?
i figured out that(after reading on uialertcontroller) moment after alert displayed, code after carried out, wold automatically give false every time. able bypass creating generic first responder exit unwind segue, , have button item trigger segue.
Comments
Post a Comment