Skip to content

Instantly share code, notes, and snippets.

@satomixx
Created August 13, 2015 02:55
Show Gist options
  • Save satomixx/48a1925f18be0770067a to your computer and use it in GitHub Desktop.
Save satomixx/48a1925f18be0770067a to your computer and use it in GitHub Desktop.
[Swift] Storyboardを使わずに画面遷移をすると、遷移先が黒画面になるときやstoryboard doesn't contain a view controller with identifier 'って言われるとき。 ref: http://qiita.com/tsumekoara/items/c8cb6f815e6dc0b6beba
let storyboard = UIStoryboard(name: "STORYBOARD_NAME", bundle: nil)
let nextVC = storyboard.instantiateViewControllerWithIdentifier("STORYBOARD_ID_OF_VC_CLASS") as! UIViewController
navigationController?.pushViewController(nextVC, animated: true)
storyboard doesn't contain a view controller with identifier 'foo''
let nextVC = FooVC() as UIViewController
nextVC.modalTransitionStyle = UIModalTransitionStyle.PartialCurl
navigationController?.pushViewController(nextVC, animated: true)
// set next VC
let nextVC: UIViewController = FooVC()
// set animation
nextVC.modalTransitionStyle = UIModalTransitionStyle.PartialCurl
// transition
self.presentViewController(nextVC, animated: true, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment