I have been playing with a simple iphone app and decided to put an NSLog statement in the deallocs of both the controller and the delegate but neither of these print out to the Xcode console?
// APPLICATION DELEGATE
#import "iPhone_buttonFunAppDelegate.h"
#import "iPhone_buttonFunViewController.h"
@implementation iPhone_buttonFunAppDelegate
@synthesize window;
@synthesize viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
NSLog(@"applicationDidFinishLaunching ...");
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
- (void)applicationWillTerminate:(UIApplication *)application {
NSLog(@"AWT:");
}
- (void)dealloc {
NSLog(@"-DEL-"); // << Does not print?
[viewController release];
[window release];
[super dealloc];
}
@end
// VIEW CONTROLLER
#import "iPhone_buttonFunViewController.h"
@implementation iPhone_buttonFunViewController
@synthesize statusText;
-(IBAction)buttonPressed:(id) sender {
NSString *title;
NSString *newText;
title = [sender titleForState:UIControlStateNormal];
newText = [[NSString alloc] initWithFormat:@"%@ button pressed.", title];
[statusText setText:newText];
[newText release];
NSLog(@"Button Press ... %@", title);
}
-(void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
NSLog(@"-1-");
}
-(void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
NSLog(@"-2-");
self.statusText = nil;
}
-(void)dealloc {
NSLog(@"-CON-"); // << Does not print?
[statusText release];
[super dealloc];
}
@end
gary