I have this storyboard:
The second viewcontroller is the login screen.
I check if user is already logged and, if its true, i want to skip the login screen and go to the tableviewcontroller. And, in the other hand, when user is not logged, show the login view and, when the user does the login, i want the next view to be the first in the navigation stack.
Now I'm setting the tableview as root element with this code explained in other post
NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:[self.navigationController viewControllers]];
InitialViewController *nvc = [[InitialViewController alloc] init];
[viewControllers replaceObjectAtIndex:0 withObject:nvc];
[self.navigationController setViewControllers:viewControllers];
It works, but when i want to click in a cell that makes a segue to detail view it doesn't work. if i delete the login screen and sets the table view as root in navigation controller it works.
Anyone knows why?
Other ways to skip login view are appreciated
EDIT: With this solution it works, now i have two navigation controllers and i change from one to another with this code
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
InitialViewController *initial = [storyBoard instantiateViewControllerWithIdentifier:@"appRootController"];
AppDelegate *myAppDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
myAppDelegate.window.rootViewController = initial;
I don't know if it's the right solution but it works.