Using ARC, I'm calling the following function in an iOS app every time the app gets opened in the applicationDidBecomeActive
function.
My concern is that it could create a memory leak because it's creating new instances of UIViewControllers
every time the app gets opened from the background.
- (void)showMainWindow{
NSLog(@"@Info @AppDelegate: Showing Main Window");
self.leftMenuViewController = nil;
self.rightMenuViewController = nil;
MenuViewController *tempLeft = [[MenuViewController alloc]initWithSide:@"left"];
MenuViewController *tempRight = [[MenuViewController alloc]initWithSide:@"right"];
self.leftMenuViewController = tempLeft;
self.rightMenuViewController = tempRight;
self.viewDeckController = [[IIViewDeckController alloc] initWithCenterViewController:self.webViewController
leftViewController:self.leftMenuViewController
rightViewController:self.rightMenuViewController];
self.window.rootViewController = self.viewDeckController;
[[NSNotificationCenter defaultCenter] postNotificationName:@"updateNavigationBar" object:nil];
}