故事板返回nil需要一些快速建议如何实例化

Msm*_*993 4 xcode instantiation storyboard ipad

我遇到了以下问题.在我的iPad应用程序中使用故事板.

-(UIViewController *)SetDetailVideoView
{
    // assign/instantiate self. storyboard, but how?
    VideosViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"VideoViewController"]; //empty but why? Because self.storyboard is empty
    NSLog(@"%@",self.storyboard); //NULL
    return vc;
}
Run Code Online (Sandbox Code Playgroud)

Self.storyboard返回nil所以它试图返回的所有内容为零并给予豁免?那么我该如何实例化呢self.storboard.

Hem*_*ore 5

使用下面的代码来实例化您的故事板

self.storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
Run Code Online (Sandbox Code Playgroud)