Skip to content

Instantly share code, notes, and snippets.

@licvido
Last active March 12, 2016 21:50
Show Gist options
  • Select an option

  • Save licvido/6e7b809c9d94055d10c5 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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

@avishaan

avishaan commented Sep 1, 2015

Copy link
Copy Markdown

Heads up self.presentModalViewController is depreciated.

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