I took some advice from the previous questions and modify the code quite a bit.I am still trying to detect when a tab bar item is being touched.If the selected index is zero is should return "moo" in nslog.I might be missing a minor detail.
view controller 1
TUHomeViewController *homeViewController = [[TUHomeViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *homeNavigationController = [[UINavigationController alloc] initWithRootViewController:homeViewController];
homeNavigationController.tabBarItem = [[DSTabBarItem alloc] initWithFinishedSelectedImage:[UIImage imageNamed:@"home"]
finishedUnselectedImage:[UIImage imageNamed:@"home1"]
iconSize:CGSizeMake(76, 59)
tag:0];
[tabBarViewControllers addObject:homeNavigationController];
view controller 2.h
@interface viewcontroller2 : UIViewController<UIWebViewDelegate,UITabBarControllerDelegate>{
}
view controller 2
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
if(self.tabBarController.selectedIndex == 0){
NSLog(@"MOO");
return(TRUE);
}
return(FALSE);
}
- (void)viewDidLoad {
[super viewDidLoad];
self.delegate = self;
}