Re: Question about MVC
Re: Question about MVC
- Subject: Re: Question about MVC
- From: "I. Savant" <email@hidden>
- Date: Wed, 26 Apr 2006 08:23:44 -0400
Craig:
I think what you really mean (or need to mean, anyway), is that
you want to have your view tell your controller to initiate the send
(likely of data in your model layer).
Your button's target and action are set to your controller (say, a
"startSendingData:" IBAction). Inside the controller's method is
where you'd actually perform the send. It's up to you to create that
method in your controller, though (unless your controller already has
the necessary methods, such as an NSController subclass). Without
knowing more about your application (specifically, what you're trying
to achieve with it), it's hard to tell you precisely what approach
you need to take.
Your message indicates you don't quite fully grasp the MVC design
pattern. I think everybody struggles with that line of thinking when
they're first introduced to it, but once you 'get it', it makes
perfect sense.
I'd suggest reading the documentation, which has a very good
explanation (with pictures, always a good thing): http://
developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/
CocoaDesignPatterns/chapter_5_section_4.html
That should clear up a few things for you. Good luck!
--
I.S.
On Apr 26, 2006, at 8:01 AM, Craig Dooley wrote:
I am trying to write a cocoa networking app, and need to have my view
initiate a data send to another host. I was wondering if there is a
standard way to have a view send information back to the controller.
I have thought of a couple ways to work around it, like using a
delegate, or keeping an instance variable of my app controller in the
view, and of the two, i like the idea of a delegate better. I would
like the keep the separation of the controller, and not call model
functions directly.
I am sorry if this is a simple topic. I checked the Hillegass book,
and "Learning Cocoa with Objective-C" and did not find anything about
a view sending data back to a controller.
-Craig
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden