xcode – Storyboard返回nil需要一些快速建议如何实例化

前端之家收集整理的这篇文章主要介绍了xcode – Storyboard返回nil需要一些快速建议如何实例化前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_1@
我遇到了以下问题.在我的iPad应用程序中使用故事板. @H_502_7@

@H_502_7@

-(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;
}
@H_502_7@Self.storyboard返回nil所以它试图返回的所有内容为零并给予豁免?
那么我如何实例化self.storboard.

解决方法

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

@H_502_7@

self.storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];

猜你在找的Xcode相关文章