I am having an issue with trying to load a viewcontroller onto another viewcontroller as a subview.
what I have is a NavigationController that loads some viewControllers in as views (pop and push etc) that works perfectly. then I have decided to put a tabBar into a viewController which then looks after all of the selection stuff using a switch statement, this switch statement then calls a method inside one of the viewControllers that appears inside the navigationController. The method inside this viewController then trys to set another viewcontroller as a subview to the viewcontroller thats inside the navgiation controller.
this is my code.
TabBarViewController.m
#import "DetailViewController.h"
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
switch (item.tag) {
case 0:
{
NSLog(@"item 1 selected");
DetailViewController *dVC = [[DetailViewController alloc] init];
[dVC tabBarSelectedAction];
}
break;
default:
break;
}
}
so this catches the selected item on the tab bar... then fires off a msg to the DetailViewController method to load the new subview onto DetailViewController.view
- (void)tabBarSelectedAction
{
ButtonOneViewController *b1VC = [[ButtonOneViewController alloc] initWithNibName:@"ButtonOneViewController" bundle:[NSBundle mainBundle]];
[self.testView addSubview:b1VC.view];
}
and this is where I am trying to load the subview onto the screen.. I think I am doing it right but for some reason its not displaying.. another thing I would like to do is animate this view from the bottom of the screen up..
any help would be hugely appreciated.