I'm having some problems that cause browsing using the navigation stack.
The problem I am facing is that after touching the tab bar item, the view controller is inserted into the navigation stack (from the view controller named FirstViewController) as follows:
- (void)viewDidLoad
{
[super viewDidLoad];
svc = [[SecondViewController alloc] init];
[self.navigationController pushViewController:svc animated:YES];
}
This works as expected, but an actual problem arises when you repeatedly touch the same element of the tab bar.
When this happens, the current view (the SecondViewController that was previously clicked) is deleted, as if I were touching the "done" button.
I cannot trace where and why this is happening.
Hope I was clear enough, thanks in advanced.
EDIT: , :
@implementation AppDelegate
@synthesize HomeViewController, FirstViewController, SecondViewController, ThirdViewController, SettingsViewController, tabBarController, window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
FirstViewController *firstViewController = [[FirstViewController alloc]
initWithNibName:nil bundle:nil];
UINavigationController *firstViewControllerNav = [[UINavigationController alloc]
initWithRootViewController:firstViewController];
SecondViewController *secondViewController = [[SecondViewController alloc]
initWithNibName:nil bundle:nil];
UINavigationController *secondViewControllerNav = [[UINavigationController alloc]
initWithRootViewController:secondViewController];
ThirdViewController *thirdViewController = [[ThirdViewController alloc]
initWithNibName:nil bundle:nil];
UINavigationController *thirdViewControllerNav = [[UINavigationController alloc]
initWithRootViewController:thirdViewController];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[firstViewControllerNav,
secondViewControllerNav];
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
[self.window setRootViewController:self.tabBarController];
[self.window makeKeyAndVisible];
return YES;
}