Skip to content

Instantly share code, notes, and snippets.

@licvido
Last active March 12, 2016 21:50
Show Gist options
  • Save licvido/6e7b809c9d94055d10c5 to your computer and use it in GitHub Desktop.
Save licvido/6e7b809c9d94055d10c5 to your computer and use it in GitHub Desktop.
SWIFT: Show modal view controller
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let loginVC: LoginViewController = storyboard.instantiateViewControllerWithIdentifier("webvc") as LoginViewController
self.presentModalViewController(loginVC, animated:true)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PrivacyPolicyViewController *privacy = (PrivacyPolicyViewController *)[storyboard instantiateViewControllerWithIdentifier:@"privacy"];
[self presentViewController:privacy animated:YES completion:nil];
@zacwolff
Copy link

Thanks man. Works perfectly. Somehow the presented view doesn't show the embedded navigation controller. Any assistance on that?

@avishaan
Copy link

avishaan commented Sep 1, 2015

Heads up self.presentModalViewController is depreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment