Depending on an XML return, I don't want the current segue
to perform on UIButton touch.
I know I can pick which segue
I want to perform, but how to I make a segue
not perform? Or at least not perform any of the available segues
?
If your deployment target is iOS 6.0 or later, you can override the -[UIViewController shouldPerformSegueWithIdentifier:sender:]
method to return YES
if you want to perform the segue and NO
if you don't.
If your deployment target is earlier than iOS 6.0, you won't receive the shouldPerformSegueWithIdentifier:sender:
message. So in your storyboard, don't draw the segue from the button. Instead, draw the segue from the button's view controller and give the segue an identifier. Connect the button to an IBAction
in its view controller. In the action, check whether you want to perform the segue. If you want to perform it, send yourself performSegueWithIdentifier:sender:
, passing the identifier you assigned to the segue in the storyboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With