You say you only want to execute segue if the condition is true?
If so, instead of creating a segue directly from a control cell or table, create a non-stop segment. In trigger mode, segue has a view controller as a source, and it will not work automatically. Instead, you can run it programmatically at any time convenient for you, including from IBAction.
To create a goalless session, start control + drag the segue from the controller icon in the scene dock at the bottom of the scene. Drag to the destination scene as usual and select a segment type. Select segue, and in the inspector, select the segue identifier.
At run time, when you want to execute segue, call - [UIViewController performSegueWithIdentifier: sender:]. You can transfer any object that you want to send to the sender, including nil. If the sender does not suit you, skip nil.
So in short:
- Create a trigger session from the view controller to the destination.
- Set session id in inspector
- At run time and form code, call [UIViewController performSegueWithIdentifier: sender:] when you want to invoke the session.
source share