开发者

cocoa / Objective-C: Cross- Class Variables

开发者 https://www.devze.com 2022-12-16 16:14 出处:网络
Hey i was searching for a solution for my problem and i nearly have it just one tiny bit... I have a NSView subclass (AppView) and a NSObject subclass (AppController)

Hey i was searching for a solution for my problem and i nearly have it just one tiny bit...

I have a NSView subclass (AppView) and a NSObject subclass (AppController) In AppView i declare a boolean with the @property than i use @synthesize and than in AppController i want to access it: i found this:

(in the implementation)

AppView *obj;
obj.booleanDraw = YES;

but i have to set obj = something ... but i have no idea what. since i just want to change the boolean from the view on a button click an开发者_开发技巧d the button action is defined in the AppController thanks for any help^^


Typically:

AppView *obj = [[AppView alloc] init];

But, possibly not in your case - I'd probably need to see more of your implementation to really give you a correct answer.


Mr-sk is right. But if this is the sort of problem you're having, I'd suggest checking this out: http://cocoadevcentral.com/d/learn_objectivec/. That's what got me started, and I think you'd feel really good if you read it too.

0

精彩评论

暂无评论...
验证码 换一张
取 消