iphone - Remove Unused ViewControllers -


When I sends click TTTabBar, tabs elected ViewController me right, then I will be a TTTabBar anywhere Click me to send each other ... etc, but how can I remove the last ViewController, so they just do not stacking on top of each other.

  - (minus) 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 sailor] viewControllerForURL: @ "TT: // profile"]; [Self.view addSubview: viewController.view]; [Self.view addSubview: _tabBar]; } Else if (SelectedIndex == 2) {UIViewController * ViewController = (UIViewController *) [[TTNavigator sailor] viewControllerForURL: @ "TT: // PMS"]; [Self.view addSubview: viewController.view]; [Self.view addSubview: _tabBar]; } Else if (SelectedIndex == 3) {UIViewController * ViewController = (UIViewController *) [[TTNavigator sailor] viewControllerForURL: @ "TT: // Friends"]; [Self.view addSubview: viewController.view]; [Self.view addSubview: _tabBar]; }}   

I got this job

  if ([ViewController isKindOfClass: [UIViewController class]]) {[viewController.view removeFromSuperview]; } {   Use 

Use:

  - (zero) removeFromSuperview   

In your scenario you have to keep the context of the current scene or make a way to refer to it by using a tag.



Comments