且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Objective-C instantiateViewControllerWithIdentifier 返回 nil

更新时间:2022-12-15 11:01:58

如果你有多个故事板,self.storyboard 返回当前 UIViewController 所在的那个.您需要检查 storybaord 的名称以获取GchConnect".并使用 storyboardWithName:bundle:

If you have multiple storyboards, self.storyboard returns the one that the current UIViewController is in. You need you check the name of storybaord for "GchConnect". And instantiate that storyboard with storyboardWithName:bundle:

UIStoryboard storyboard = [UIStoryboard storyboardWithName:bundle:nil];
GCHConnectViewController* gchCVC = [storyboard instantiateViewControllerWithIdentifier:@"GchConnect"];