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