我正在尝试实现一个包含主登录页面(在 Storyboard 中实现)的应用程序,它将用户引导到 UIWebView(在 xib 中实现)。登录成功后,我希望应用程序从 xib 返回到特定场景(由 Segue 连接),而是返回到主场景。
我从以下链接获得了帮助,但是,我仍然遇到同样的问题: 如何从视图控制器加载情节提要中的场景并 从 xib 或带有情节提要的其他场景中添加子视图
我的主视图控制器如下所示:
- (IBAction)loginButton:(id)sender
{
oAuthLoginView = [[OAuthLoginView alloc] initWithNibName:nil bundle:nil];
[oAuthLoginView retain];
// register to be told when the login is finished
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(loginViewDidFinish:)
name:@"loginViewDidFinish"
object:oAuthLoginView];
[self presentModalViewController:oAuthLoginView animated:YES];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
UINavigationController *navigationController = [self.storyboard instantiateViewControllerWithIdentifier:@"check2"];
// SecondViewController *viewController = navigationController.viewControllers[0];
//
// // setup "inner" view controller
// // viewController. = bar;
//
// [self presentViewController:navigationController animated:YES completion:nil];
}
-(BOOL) loginViewDidFinish:(NSNotification*)notification
{
[self performSegueWithIdentifier:@"afterLoginScreen" sender:self];
return YES;
// [self performSegueWithIdentifier:@"mainApp" sender:self];
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
// ProfileTabView * yourView = (ProfileTabView *)[storyboard instantiateViewControllerWithIdentifier:@"segueID"];
// [self.presentedViewController:yourView animated:YES completion:^{}];
//[self switchToStoryBoard];
}
我尝试了很多不同的方法(在此处的代码中进行了注释),但它要么导致应用程序崩溃,要么返回主登录屏幕。
我错过了什么?
任何帮助表示赞赏:)