storyboard ID

The storyboard ID is a String field that you can use to create a new ViewController based on that storyboard ViewController. An example use would be from any ViewController:app

//Maybe make a button that when clicked calls this method - (IBAction)buttonPressed:(id)sender { MyCustomViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"]; [self presentViewController:vc animated:YES completion:nil]; }

This will create a MyCustomViewController based on the storyboard ViewController you named "MyViewController" and present it above your current View Controllerpost

And if you are in your app delegate you could usethis

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];

Edit: Swiftspa

@IBAction func buttonPressed(sender: AnyObject) { let vc = storyboard?.instantiateViewControllerWithIdentifier("MyViewController") as MyCustomViewController presentViewController(vc, animated: true, completion: nil) }

andcode

let storyboard = UIStoryboard(name: "MainStoryboard", bundle: nil)
相關文章
相關標籤/搜索