在我的应用程序中,我有2个故事板,一个具有所有配置屏幕,另一个具有应用程序的主屏幕。
在应用程序的一个主屏幕中,用户可以按一个按钮,允许他们返回并编辑或添加任何配置。
问题是如果用户来自主屏幕,一旦他们按配置屏幕上的完成按钮确认他们的更改,有没有办法我可以回到主屏幕故事板然后切换到屏幕他们以前是在进行配置之前吗?
答案 0 :(得分:1)
您需要在故事板之间切换代码。
- (IBAction)showNextStoryboard:(id)sender
{
UIStoryboard *nextStoryboard = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:nil];
UIViewController *nextRoot = [nextStoryboard instantiateInitialViewController];
[self presentViewController:nextRoot
animated:YES
completion:^{}];
}
返回:
- (IBAction)returnToPreviousStoryboard
{
[self.presentingViewController dismissViewControllerAnimated:YES completion:^{}];
}