small medium large xlarge

18 Jan 2010, 21:00
Adam Teale (3 posts)

Hi Guys,

I am able to get a response from a mouseDown event via: (void)mouseDown:(NSEvent *)event;

However whenever I try to return the value of a global variable, via NSLog, I am getting the initial value I declared the variable in the “- (void)awakeFromNib;” method.

For example: #Controller.h

` @interface Controller : NSView { NSString *a; }

  • (void)blah;




` (void)awakeFromNib { a = @”test”; self blah;


(void)blah { a = @”green”; }

(void)mouseDown:(NSEvent *)event { NSLog(@”%@”, a); }


The example above logs ‘a’ as “test”, not “green”.

The xib file has an NSView object hooked up to the class “Controller”.

Can anyone shed some light on where I am going wrong here?



18 Jan 2010, 21:01
Adam Teale (3 posts)

sorry looks like the post’s format is all over the place. I posted on the apple dev forums as well:

You must be logged in to comment