Unable to call storyboard from xib
- by Shruti Kapoor
I am new to iOS development. I am trying to connect to a storyboard from xib file. My xib View Controller has a "Login" which if successful should connect to storyboard. I have googled and searched on stackoverflow for a solution and I am using this code that is given everywhere:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
YourViewController * yourView = (YourViewController *)[storyboard instantiateViewControllerWithIdentifier:@"identifier ID"];
I have created an identifier for my storyboard as well. However, I am not being redirected to the storyboard no matter what I try. When the login finishes, I go back to my main View Controller (xib). I should be instead redirected to the storyboard. Here is what my code looks like in a file called ProfileTabView.m:
-(void) loginViewDidFinish:(NSNotification*)notification
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
ProfileTabView * yourView = (ProfileTabView *)[storyboard instantiateViewControllerWithIdentifier:@"myID"];
}
I have implemeted this code in the function that gets called once the login is successful. However, the storyboard "Storyboard" never gets called. Am i doing this right? Am I supposed to be writing this code anywhere else?
Thanks a lot for any help :)