What you should probably do is keep strong references to the content view controller in your menu controller as properties.
@private (nonatomic, strong) UINavigationController *navController1;
@private (nonatomic, strong) UINavigationController *navController2;
....
Then
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if([indexPath row] == 0)
{
if (!self.navController1) {
UIViewController *firstviewcontroller = [self.storyboard instantiateViewControllerWithIdentifier:@"firstviewcontroller"];
self.navController1 = [[UINavigationController alloc] initWithRootViewController:firstviewcontroller];
}
if ([self splitViewController] viewControllers] lastObject] != self.navController1) {
NSArray *vcs = [NSArray arrayWithObjects:[self navigationController], self.navController1, nil];
[[self splitViewController] setViewControllers:vcs];
[[self splitViewController] setDelegate:self.navController1.rootViewController];
}
}
}
This way they won't be recreated each time and your state is preserved.