2012-01-23 18 views

回答

5

可以使用的UITabBarController的委託爲做到這一點 -

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController 
{ 
    if ([tabBarController selectedIndex] == 2) 
    { 
     NSMutableArray *arr = [[NSMutableArray alloc] initWithArray:[tabBarController viewControllers]]; 

     NewViewController *nvc = [[NewViewController alloc] init]; 

     [arr replaceObjectAtIndex:1 withObject:nvc]; 

     [nvc release]; 

     [tabBarController setViewControllers:arr]; 
    } 
} 
+0

謝謝...我得到的想法.. – DipakSonara

相關問題