I have 3 ViewController, flow: rootviewcontroller is view1 , when i click on "Start"button in view1, it push view2 and then click on "Status" button in view2, it push view3 . In view3 has uitabbarcontroller and inside tabbarcontroller has 2 UINavigationController . My problem is : When click on "Logout"button in UINavigationController in tabbarcontroller, i call back view2. But when view2 appear, I click on "Status"button, it can not push view3. Code for created UItabbarcontroller
self.tab=[[UITabBarController alloc]init];
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568)
{
// code for 4-inch screen
// LoginButton.frame = CGRectMake(0, 518, 80, 49);
self.tab.view.frame = CGRectMake(0,0,320,568);
}
else if (screenBounds.size.height == 1024)
{
//code for ipad
}
else if (screenBounds.size.height == 480)
{
// code for 3.5-inch screen
// LoginButton.frame = CGRectMake(0, 430, 80, 49);
self.tab.view.frame = CGRectMake(0,0,320,480);
}
// FirstViewController
UploadTab *uploadview=[[UploadTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *uploadTabItem = [[[UINavigationController alloc] initWithRootViewController: uploadview] autorelease];
uploadview.title=@"Uploading";
uploadview.tabBarItem.image=[UIImage imageNamed:@"Uploading.png"];
self.title = @"FirstViewControllerTitle";
//SecondViewController
ConvertTab *convertView=[[ConvertTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *convertTabItem = [[[UINavigationController alloc] initWithRootViewController: convertView] autorelease];
convertView.title=@"Convert";
convertView.tabBarItem.image=[UIImage imageNamed:@"Convert.png"];
//ThirdViewController
CompletedTab *completedView=[[CompletedTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *completedTabItem = [[[UINavigationController alloc] initWithRootViewController: completedView] autorelease];
completedView.title=@"Completed";
completedView.tabBarItem.image=[UIImage imageNamed:@"Completed.png"];
UIBarButtonItem * LogoutItem= [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Logout.png"] style:UIBarButtonItemStylePlain target:self action:@selector(logout)];
self.navigationItem.rightBarButtonItem = LogoutItem;
self.tab.viewControllers=[NSArray arrayWithObjects:uploadTabItem,convertTabItem, completedTabItem, nil];
[self.view insertSubview:self.tab.view belowSubview: uploadview.view];
[self presentModalViewController:self.tab animated:NO];
I use below code to call back view2:
- (void) handleBack:(id)sender
{
ChooseViewController *chooseview = [[ChooseViewController alloc] init];
[self.navigationController pushViewController:chooseview animated:NO];
[chooseview release];
}
I used [self.navigationController presentModalViewController:loginView animated:YES];
. I thinks it made view2 can not push view3.
Do you have any suggestions ? Thanks a lot