Hello,
I couldn't realize why this code is being marked as having memory leaks:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
MenuViewController *menuView = [[MenuViewController alloc] initWithNibName:@"MenuView" bundle:[NSBundle mainBundle]];
navigationController = [[UINavigationController alloc] initWithRootViewController:menuView];
navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"livreto-verso-horizontal.png"]]; // memory leak here 47,1%
[menuView release];
BilheteViewController *rightView = [[BilheteViewController alloc] initWithNibName:@"BilheteView" bundle: [NSBundle mainBundle]];
spliViewController.viewControllers = [NSArray arrayWithObjects:navigationController, rightView, nil]; // memory leak here 52,9%
[window addSubview:spliViewController.view];
[window makeKeyAndVisible];
[rightView release];
return YES;
}
Just the lines marked with problems:
navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"livreto-verso-horizontal.png"]]
and
spliViewController.viewControllers = [NSArray arrayWithObjects:navigationController, rightView, nil];
How do I solve this leaks?
Update 1
App Delegate's dealloc method, both navigationController and spliViewController are being released:
- (void)dealloc {
[navigationController release];
[spliViewController release];
[window release];
[super dealloc];
}