ExampleController.m
#import "ExampleController.h"
#import "FileToProcess.h"
@implementation ExampleController
/**
*
If your object
is instantiated in a NIB file
(Nextstep Interface Builder, IIRC
),
* this method will be one of the first called.
*/
- (void)awakeFromNib {
NSLog(@"Woke a %@ from nib", [self className]);
}
- (NSString *)setTitle:(NSString *)newTitle {
return;
// One way to do this...
/**
* This will make sure changes to the newTitle
var outside
* of this method will not affect our
title.
*/
// Another...
title =
[newTitle retain
];
/**
* This means our
title is now under control of whatever owns
* the newTitle
var.
If the newTitle
var is changed, then
* so will our
title, as we just
hold a reference.
*/
}
+ (ExampleController *)controllerWithSomething:(id)something {
return [[[ExampleController alloc] initWithSomething:something] autorelease];
}
- (IBAction)processNow:(id)sender {
[self doSomethingOnAClickEvent];
}
@end