views:

195

answers:

1

Hey People^^

Situation: Noob / Xcode 3.1

I have an AppView (NSView subclass) and an AppController (NSObject subclass)

in AppView.h i declare a boolean (BOOL: booleanDraw), which i set to 'NO' in AppView.m

When a button is clicked it 'launches' an action (AppController .h/.m) now i want to change booleanDraw to YES when the button is clicked.

I searched and found: do it with @property okay i tried to do that but it didnt work. (because i didnt totally get what to do probably) i did:

@property BOOL booleanDraw;

(in AppView.h)

@implementation AppView

@synthesize(readwrite, nonatomic) booleanDraw;

(in AppView.m)

AppView *obj;
obj.booleanDraw = YES;  // implicitly calls [obj setVar:3]

(in AppController.m)

Thanks for any help, i read some tutorials already but often they suggest some steps that should be basic but that dont belong to my repertoire, and the ADN often confuse me xD sorry but believe me im trying^^

+3  A: 

You just reversed the synthesize and property statements:

in .h:

@property (nonatomic) booleanDraw;

(by default properties are readwrite, you only need to state when they are readonly)

in .m:

@synthesize booleanDraw;

In the controller you need to get the app view reference, the code you posted would not work unless you set "obj" to something.

Kendall Helmstetter Gelner
damn my bad xD oh and i never understood (soorry) what i should set obj to ... because i dont need it infact
Samuel