Newbie question:IB, NSView, NSViewController
Newbie question:IB, NSView, NSViewController
- Subject: Newbie question:IB, NSView, NSViewController
- From: Johnny Andersson <email@hidden>
- Date: Thu, 5 Jun 2008 15:46:17 +0200
Hi,
I'm a newcomer and I've been learning Cocoa for about a month now.
I've successfully created simple GUI apps to get acquainted with the
environment, but now I've hit a little wall trying to grasp the
concepts.
It's about NSView and NSViewController. Bear in mind that I come from C
++/Qt (if you're familiar with that); I'm probably still applying the
Qt way of thinking to Cocoa, and I'm trying my best to shift mindset.
Please bear with me. ;-)
I've created a View (let's call it DrawView) where the user can draw
lines. It is created directly in code, DrawView.{m,h}. It has two
IBActions: undo and clear. It doesn't do anything else, because I
may want to reuse this code for another purpose.
To make it more specific for this application, I want to embed that
view in a larger view, created in Interface Builder, that contains
two buttons (Undo / Clear), connected to the actions in the DrawView.
No problem, I just drag an NSView on this parent view and set the
type to DrawView.
Finally, I want to use a NSViewController as the glue between my view
and a handwriting recognition engine. This is where I don't know how
to continue.
To understand what I have problems with, let's suppose that I want to
put a "module" consisting of an NSViewController, controlling the view
with two buttons, which in turn contains a DrawView, on my main
window. Do I put my DrawViewController in the root of the MainWindow
NIB, and if so, how do I specify where the view will end up? Or, do I
instantiate a a DrawViewController in my DrawView NIB, and put a
DrawView directly into the main window?
I know I'm not explaining this very well; I don't understand the
concepts well enough to do that yet. If it helps, here's what I would
have done if I was using Qt:
1) Create DrawWidget
2) Create FancyDrawWidget (containing the buttons, a DrawWidget and
connections)
3) Create HandwritingWidget, which contains all the logic + a
FancyDrawWidget.
4) Plop a HandwritingWidget somewhere on my main window.
I'd be grateful for any help - including help on "how to ask the right
question".
Kind regards,
Johnny
_______________________________________________
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