当我点击TTTabBar时,选中的选项卡发送给我一个正确的ViewController,然后我点击另一个TTTabBar它会将我发送给另一个..... etc,但我该如何删除最后一个ViewController,所以它们不会一直堆叠在一起。删除未使用的ViewControllers
- (void)tabBar:(TTTabBar*)tabBar tabSelected:(NSInteger)selectedIndex
{
if(selectedIndex == 0){
UIViewController* viewController = (UIViewController*)[[TTNavigator navigator] viewControllerForURL:@"tt://Forum"];
[self.view addSubview:viewController.view];
[self.view addSubview:_tabBar];
}else if(selectedIndex == 1) {
UIViewController* viewController = (UIViewController*)[[TTNavigator navigator] viewControllerForURL:@"tt://Profile"];
[self.view addSubview:viewController.view];
[self.view addSubview:_tabBar];
}else if(selectedIndex == 2) {
UIViewController* viewController = (UIViewController*)[[TTNavigator navigator] viewControllerForURL:@"tt://PMs"];
[self.view addSubview:viewController.view];
[self.view addSubview:_tabBar];
}else if(selectedIndex == 3) {
UIViewController* viewController = (UIViewController*)[[TTNavigator navigator] viewControllerForURL:@"tt://Friends"];
[self.view addSubview:viewController.view];
[self.view addSubview:_tabBar];
}
}
我得到这个工作
if ([viewController isKindOfClass:[UIViewController class]]) {
[viewController.view removeFromSuperview];
} else {
}
当我将它上面
if(selectedIndex == 0){
if([viewController isKindOfClass:[UIViewController class]]){ \t \t [viewController.view removeFromSuperview]; \t}其他{ \t \t \t} – Duny 2011-03-17 01:21:32
谢谢,我添加了什么我得到了工作上面 – Duny 2011-03-17 01:24:02