• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about MVC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about MVC


  • Subject: Re: Question about MVC
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 26 Apr 2006 08:49:44 -0400


It depends entirely on your goal, but no, there's nothing that says you can't reference your controller. You can also use the delegate methods of course.


In the case of a drawing application (like the Sketch example), the view subclass used as the canvas asks its controller for any "Shapes" that are under the cursor (by seeing if the cursor is within the bounds of any shapes). From there it makes decisions what to do. To me it sounds like the Sketch example is the best fit for your project. It's in your /Developer/Examples folder. That one example has a *wealth* of information in it on this topic.

My point was that the 'best course' depends entirely on what exactly you're trying to accomplish. You *need to read the documentation* to make an educated choice, though. The link I sent last really is an excellent place to start in this case. ;-)

--
I.S.


On Apr 26, 2006, at 8:39 AM, Kenny Millar wrote:

I.S,

That's an interesting reply, and I understand exactly your point of view.
However I too am currently pondering an MVC design, where I can't think of
any other way but by having the view maintain an instance variable of the
controller... let me explain.


My data contains a set of objects, which the view renders to the screen.
When the user clicks in the view, whichever object he clicked on becomes the
'current' object, and the controller needs to know which is the 'current'
object. How can you do that without the view telling the controller, and how
can the view tell the controller without either i)using a delegate, or
ii)maintain an instance variable and sending messages to the controller?


Maybe I just haven't grasped the full MVC picture yet, but I'm just a newbie
so willing to be shown the right direction!


-Kenny

-----Original Message-----
From: cocoa-dev-bounces+kennymillar=email@hidden
[mailto:cocoa-dev-bounces+kennymillar=email@hidden] On Behalf Of
I. Savant
Sent: 26 April 2006 13:24
To: Craig Dooley
Cc: email@hidden
Subject: Re: Question about MVC


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).
<snip>


_______________________________________________ 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
References: 
 >RE: Question about MVC (From: "Kenny Millar" <email@hidden>)

  • Prev by Date: Re: Question about MVC
  • Next by Date: Re: Question about MVC
  • Previous by thread: Re: Question about MVC
  • Next by thread: Re: Question about MVC
  • Index(es):
    • Date
    • Thread