I had an application in which i had a tab bar controller with 4 navigation controllers.
_tabbarcontroller = [[UITabBarController alloc] init];
_tabbarcontroller.viewControllers = [NSArray arrayWithObjects:vcontroller,xnav,ynav,znav,nil];
and everything works fine. Now I want to add a view over the selected viewcontroller when the 0th item selected in the tab bar; this must be over the tabbarcontroller. What I tried:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
NSUInteger selectedIndex = [_tabbarcontroller.viewControllers indexOfObject:self];
UITabBar *tabBar = self.tabbarcontroller.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
if(tabBar.selectedItem==item0)
{
tabBarController.selectedIndex=selectedIndex;
FViewController *fviewcontroller =[[FViewController alloc] initWithNibName:@"FViewController" bundle:nil];
[_tabbarcontroller.view addSubview: fviewcontroller.view];
}
}
But it doesn't seem right. I want it to be added over the present selected view controller and when selecting out side that small view needs to remove that also. can anybody guide me on this?