I am trying to implement an app that includes a main Login page(implemented in Storyboard) which directs the user to a UIWebView (implemented in xib). When the login is successful, I expect the app to return from the xib to a particular scene (connected by Segue) but instead it returns to the main scene.
I had help from the following links however, I still have the same problem: How to load a scene in a storyboard from a view controller and Add subview from a xib or another scene with storyboard
My main View Controller looks like this:
- (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];
}
I have tried a lot of different things(commented in the code here) but it either leads to crashing the application or returns back to the main login screen.
What am I missing?
Any help appreciated :)