I have a storyboard with a button in a Navigation View Control, this control has textfields in as well, which uses the storyboard segue push
.
However, I have some input checking, and I alert the user if any of the text fields are empty.
I can do this, BUT it alerts the user, and then switches to the other view.
Is there a way to cancel this push
if an if condition is not met in the button Pressed method?
N.B This push was created by the storyboard interface, not by code.
Don't create the segue by dragging from the button to the destination controller. Instead, just drag from the source controller to the destination controller to create a segue. Click on the segue and use the attribute inspector to specify the segue is a push and give the segue an identifier (goToDestination). Then connect the button to an IBAction in the source view controller. In the IBAction method do your checking and if you want to do the push add this line of code:
[self performSegueWithIdentifier: @"goToDestination" sender: self];
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