代码创建storyboard

时间:2023-03-08 22:03:25

代码创建storyboard方式如下

//
加载storyboard

UIStoryboard
*storyboard = [UIStoryboard
StoryboardWithName:@"storyboard名称"
bundle:nil];

// 创建storyboard里面箭头所指的控制器

* UIViewControl *vc = [storyboard
instantiateInitialViewController];

* UIViewControl *vc = [storyboard
instantiateInitialViewControllerWithIdentifier:@"控制器的ID"];

// 将storyboard里面箭头所指的控制器作为window的根控制器

self.window.rootViewControl
= vc;

如果有错或有什么问题请联系我,转载请注明出处,谢谢!