I have only two ViewControllers in my app
Storyboard setting: –

I have a push segue directly connected from my ViewController to MainTableViewController.I want to my app to redirect to Main View as soon as user enters the right passcode.
Here is my code: –
- (IBAction)checkInput
{
NSMutableString *aString = [NSMutableString stringWithFormat:firstDigit.text];
[aString appendFormat:secondDigit.text];
[aString appendFormat:thirdDigit.text];
[aString appendFormat:fourthDigit.text];
if([aString isEqualToString:@"1111"])
{
result.text = @"Right Password";
//UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryBoard" bundle:nil];
//UITableViewController *tvc = [self.storyboard instantiateViewControllerWithIdentifier:@"mainTableViewController"];
//[self.navigationController pushViewController:tvc animated:YES];
//[self removeFromParentViewController];
[self performSegueWithIdentifier:@"mainSegue" sender:self];
}
else {
result.text = @"Wrong Password";
}
NSLog(@"%@", aString);
}
checkInput is getting called as soon as user enters the last digit. I am calling it on Editing did End of my fourth TextField.
Any help would be really appreciated.
Thanks
Another idea is to embed your main view in a navigation view controller and use it as initial vc. Then present the passcode vc modaly when its needed on top of the main vc. Another advantage of this way is that you now can use
popToViewController:animated:which you can not use this way at the moment.