Hi all, I want to set return value of ShouldPerformSegue method according to user's choice in a UIAlertController. Is it possible? if not, what else can I do?
Thanks for your time.
ShouldPerformSegue will only be triggered right before a segue (which is declared in your storyboard) is about to be performed. What you could do though is to call PerformSegue in your code based on the result of your UIAlertController. Note that a segue between your source and destination controller needs to be in place for this to work.
I have done something similar in our app to achieve the same thing so I have some more ideas if this does not work for you.
Of course you can do this. You can define a bool property in the ViewController. When user select a choice in the UIAlertController, it will trigger the handler of a UIAlertAction. Set the property there, And you can return this property when user wants to push to another view controller using a segue.
I think you misunderstood me. I want to present UIAlertController when user pushes to another view controller using a segue. Not before that. I simply want to ask users if they are sure about log off.
Hi andnes, it worked thank you. I didn't know calling PerformSegue is that easy
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies