Re: fresh newbie question
Re: fresh newbie question
- Subject: Re: fresh newbie question
- From: Adhamh Findlay <email@hidden>
- Date: Mon, 18 Feb 2008 09:35:03 -0600
On Feb 18, 2008, at 8:59 AM, Mei Fang Liau wrote:
I wrote a controller class inherited from NSObject, which contains a
outlet
with the main window (NSWindow) as the destination. This outlet is
used to
scan the main window's subviews and find all check boxes and store
them in
an array. Can I also do the same thing with a controller inherited
from
NSView? On the main window there are some check boxes and a custom
view. I
would like to change the color of my custom view according to the
check
boxes' status. But I find out that I can't likewise just set an
Outlet for
this subclass of NSView and scan the content of the main window... can
anyone give me some suggestion? (or what tutorial I should check
out...
there are just too many functionalities I am lost :o)
______________________________________________
Hi,
I don't think you are using the right pattern. Normally you want your
controller class to inherit from NSWindowController and not NSObject,
so that you can take advantage of the built in goodies.
Definitely don't have you controller inherit from NSView. If you just
need to control a view then you should look at NSViewController.
Cocoa follows the MVC paradigm pretty closely. You can read about
that here:http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html
. In fact the entire fundamentals guide is a must read. http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/chapter_1_section_1.html
.
As for a tutorial there are several. Start at Scott Stevenson's
excellent http://cocoadevcentral.com/d/learn_cocoa/. If that's too
basic then take a look at this other ones.
Apple also has an introductory tutorial at:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/01Introduction/chapter_1_section_1.html
.
More programming guides are available at:
http://developer.apple.com/referencelibrary/Cocoa/idxDesignGuidelines-date.html
Finally, you should go ahead and pre-order the 3rd edition of Cocoa
Programming.
http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619
It won't be out until June, but at this point the 2nd edition is
getting too old to be really useful.
The http://cocoadev.com/ wiki is also your friend.
So, start with the tutorials and read the guides to get more
information on how things work.
Adhamh
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden