tags:

views:

14

answers:

0

I have an iPad application that has one toolbar on the top with 1 segmented control button with two options. When you select one of the options, a view is loaded So the MainViewController.m has the following code:

FirstSegmentView *fv = [[FirstSegmentView alloc] initWithNibName:@"FirstSegmentView" bundle:nil];
self.firstSegmentViewController = fv;
[self.view insertSubview: firstSegmentViewController.view atIndex:0];
[fv release];

This loads the first view, but in the FirstSegmentViewController I have a button that when pressed should bring up another view with a back button back to the original view. But the Original view is the MainView with the Toolbar with the segmented control. I've tried to wrap *fv as a navigationcontroller as such:

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController: fv];
[callDelegate: hideToolBarInMainView];
[self.view insertSubview:nav.view atIndex0];

and in the FirstSegmentViewController.m in the buttonaction method I have:

UIBarButtonItem *btn=[[UIBarButtonItem alloc] initWithTitle:@"First Segment" style:UIBarButtonItemStyleBordered target:self action:@selector(callDelegate:)];
[self.navigationItem setBackBarButtonITem:btn];
[self.navigationController pushViewController:detailView animated:YES];

So this does what is expected it goes to the other view, but when I click the back button it goes back to the previous view which is the segment view, but I am unable to capture the call to callDelegate which unhides the Toolbar in the main view. Also, I'm unable to capture any log messages embedded in all of the viewDidUnload, ViewWillDisappear, dealloc of the detail view when pressing the backbutton. Odd. I'm just trying to navigate between views in which the first view is a subview of the mainview.

My question is can I use the UINavigation Controller in the Ipad to navigate between views, and if so how, and if I cannot use UINavigationController to navigate between views, how can I navigate between views in which the first view is a subview, ideally with a rightToLeft Animation as in the iphone when the navigationController pushes anotherView, and when the user clicks back pop the detailview.

Thanks Gerard