technoY2K
technoY2K

Reputation: 2570

How to segue to another storyboard with UIAlertAction handler:

I have a modal pop open when a user clicks a button using UIAlertController.

let agreeAction = UIAlertAction(title: "Agree", style: .Default, handler: nil)

Currently the handler is set to nil, but I would like for it to take the user to a viewcontroller in another storyboard. I tried the following which does not seem to work.

handler: UIViewController *theInitialViewController = [secondStoryBoard otherViewController];

Any direction or suggestions would be greatly appreciated.

Upvotes: 2

Views: 256

Answers (1)

Andy Ibanez
Andy Ibanez

Reputation: 12254

The handler parameter is a block that takes a UIAlertAction and returns Void. Your handler parameter should therefore look something like this:

{(alert: UIAlertAction!) in
    self.performSegueWithIdentifier("segueId", sender: self);
})

For future reference: UIAlertController Class Reference

Upvotes: 1

Related Questions