Search code examples
iphonetabsuinavigationcontrolleruitabcontroller

get reference of the application window in the succeeding classes IPHONE app


I am adding tab controller on my 4th screen. Up to 4th screen my navigation bar is visible now on the 4th screen when i am adding Tab Controller to the window, navigation bar is getting disappeared...

code written in the tabbedController class is :




- (void)viewDidLoad
{
        self.tabController = [[UITabBarController alloc]init];
    FirstTabScreen *firstTab = [[FirstTabScreen alloc]initWithNibName:nil bundle:nil];
    SecondTabScreen *secondTab = [[SecondTabScreen alloc]initWithNibName:nil bundle:nil];

    firstTab.title=@"First";
    firstTab.tabBarItem.image = [UIImage imageNamed:@"small_star.png"];
    secondTab.title=@"second";
    secondTab.tabBarItem.image = [UIImage imageNamed:@"small_star.png"];

    tabController.viewControllers = [NSArray arrayWithObjects:
                                     firstTab,
                                     secondTab,
                                     nil];

  //  self.tabWindow = [[[[UIApplication sharedApplication]keyWindow ]subviews ] lastObject];

    //self.tabWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   // self.tabWindow = [[UIApplication sharedApplication] keyWindow ];
    //self.tabWindow = self.appDelegateAccess.window;
    self.tabWindow = self.appDelegateAccess.window;
    [self.tabWindow addSubview:tabController.view];
    [self.tabWindow makeKeyAndVisible];


  //  [self.view addSubview:tabsContainer.view];

    [super viewDidLoad];

    // Do any additional setup after loading the view from its nib.
}

Please let me know where I am going wrong.... i think I am not referencing the root window for adding the tab controller .. it it is the case please suggest me the way to take root window for adding tab controller

this is third screen...

this is 4th screen

Thanks


Solution

  • why are you adding the tabbarcontroller in the window. why dont you add it in self.view ?