Search code examples
iphoneobjective-cuitabbar

problem with tab bar, not displaying the tab bar upon navigating to that page


In my test project I have some 5 tabs on click of a tab it will go to that corresponding class, on click of back in that screen I will come back to my home page but with out the tab bar.. earlier what 5 tabs were there those are not coming ...

following code I am using under back button where DataEntry is the class to where i need to navigate

- (void) back_Clicked:(id)sender 
{
     DataEntry *avController;
    UINavigationController *addNavigationController;


    if(avController == nil)
        avController = [[DataEntry alloc] initWithTabBar];

    if(addNavigationController == nil)
        addNavigationController = [[UINavigationController alloc] initWithRootViewController:avController];

    [self. navigationController presentModalViewController:addNavigationController animated:YES];

} 

is I have to add that navigation controller to the tab view? how can I get the tab bar on click of back can any one help me ,thanx in advance


Solution

  • As I understand this, you must already be pushing this view controller either via navigation controller or modally. So the idea would be to simply dismiss it right?

    If you have used [self.navigationController pushViewController:animated:] then just do [self.navigationController popViewControllerAnimated:YES]; . This should take you back to the earlier view controller.

    If you have presented this modally like you have done here, you should do [self.navigationController dismissModalViewControllerAnimated:YES];.