How do I change “initwithNibName” in storyboard?

前端 未结 2 1116
天涯浪人
天涯浪人 2020-12-07 11:22

I want to change below code with storyboard with Xcode 4.2.

UIViewController * example     = [[ExampleViewController alloc] initWithNibName:@\"ExampleViewCon         


        
2条回答
  •  囚心锁ツ
    2020-12-07 11:52

    • If it is still in its own xib file, then you don't change anything.
    • If you've moved everything into a storyboard, then you wouldn't often need to do this as you'd link between view controllers using segues.

    If neither of the above are true, i.e. your view controller is on the storyboard but no segue connects to it, then you want UIStoryboard's instantiateViewControllerWithIdentifier: method described in the documentation. You have to set the identifier in the storyboard for this to work.

提交回复
热议问题