How do you call to a segue, only if a if statement is true ?

How do you call to a segue, only if a if statement is true ?

Tagged:

Best Answer

Answers

  • NikiNiki BGMember ✭✭✭

    I'm assuming you're talking about a button here, but it can easily be applied to anything. Connect the segue from your ViewController, NOT from your button. Name the segue, e.g. ItemDetailsSegue and connect an action outlet from OnTouchUpInside of your button. Then in the implementation of action, you can do something like:

    if (this.CheckCondition())
    {
      this.PerformSegue("ItemDetailsSegue", this);
    }
    
  • BrandonBooneBrandonBoone USMember ✭✭

    i got it to work

Sign In or Register to comment.