How do I change “initwithNibName” in storyboard?

前端 未结 2 1204
天涯浪人
天涯浪人 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 12:04

    The UIStoryboard class is your friend:

    UIStoryboard* sb = [UIStoryboard storyboardWithName:@"mystoryboard"
                                                  bundle:nil];
    UIViewController* vc = [sb instantiateViewControllerWithIdentifier:@"ExampleViewController"];
    

提交回复
热议问题