我是iOS开发的新手。我正在尝试从xib文件连接到storyboard。我的xib视图控制器有一个“登录”,成功后应该连接到storyboard。我已经在Google和StackOverflow上搜索了解决方案,我正在使用到处都提供的这段代码:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
YourViewController * yourView = (YourViewController *)[storyboard instantiateViewControllerWithIdentifier:@"identifier ID"];
我已经为我的Storyboard创建了一个标识符。不过,无论我尝试什么方法都无法重定向到Storyboard。当登录完成后,我回到我的主视图控制器(xib),而应该重定向到Storyboard。下面是我在名为ProfileTabView.m的文件中的代码:
-(void) loginViewDidFinish:(NSNotification*)notification
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
ProfileTabView * yourView = (ProfileTabView *)[storyboard instantiateViewControllerWithIdentifier:@"myID"];
}
我已经在登录成功后被调用的函数中实现了这段代码。然而,“Storyboard”故事板从未被调用过。我是否做得对?我应该在其他地方写这段代码吗?
非常感谢任何帮助 :)