How to “cancel” a UIStoryBoardSegue

前端 未结 9 1834
小蘑菇
小蘑菇 2020-12-23 21:40

Does anyone know how to \"stop\" a segue transition conditionally:

My table view cells represent products which can be viewed in a drill-down \"detail\" view... or

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-23 21:53

    I don't know if it is the right way to do it but I discovered a workaround.

    From the storyboard I associate(control+click) a segue from the status bar in the view controller. Give the segue an ID (for example: switchSegue).

    Now, from an action in your code (in my code I use a button), I call:

     [self performSegueWithIdentifier:@"switchSegue" sender:sender];
    

    That way you can control if your segue is performed or not. Try tutorials that helped me from here and here

    Hope this helps.

提交回复
热议问题