Reputation: 1011
In my application, i have a UIViewController
that presents a UItabBarController
(that has 3 NavigationControllers
as tabBarItems
), then i dismiss the UITabBarController
from that UIViewController
.
But when i present it again, the old data still shows on the tabBarController
(i mean all the data that is displayed on the UIViewControllers
of the NavigationControllers
is still displayed). I want the UITabBarController
as good as new when it is presented again. How to do this??
Here's the code:
In AppDelegate.h
, i made this property
@property (strong, nonatomic) UITabBarController *tabBarController;
Then, in AppDelegate.m
self.customerCareNavController = [[UINavigationController alloc] initWithRootViewController:self.custCareVC];
self.customerCareNavController.title = @"Customer Service";
self.purchaseOrderNavController = [[UINavigationController alloc] initWithRootViewController:self.POController];
self.purchaseOrderNavController.title = @"PO";
self.accAndContactsNavController = [[UINavigationController alloc] initWithRootViewController:self.accAndContactsController];
self.accAndContactsNavController.title = @"Accounts And Contacts";
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:self.customerCareNavController, self.accAndContactsNavController, self.purchaseOrderNavController, nil];
Upvotes: 1
Views: 372
Reputation: 104092
Is there a reason you're doing this in the app delegate? If you're presenting the tab bar controller from another view controller, you should put all that code in the method where you do the presentation and don't create a property for it, or any of its controllers, just local variables. The presenting controller will keep a reference to it, so you don't need to. When you dismiss it, it and all its content controllers will be deallocated.
Upvotes: 1