Hi,
My app has a window with a myView, an AppController and my own class to
read and write my data files.
The AppController has buttons to open the data file and manipulate the
data and has myView as an outlet to display the data. It's similar to
the way Hillegrass displayed a jpg in his Cocoa book using [stretchView
setView] in his AppController to shuffle the jpg to his View class.
So, AppController knows about myView and the data file which I call
pagefile.m. but myView doesn't know about pagefile.m
It would be better to manipulate the data further before I display it in
myView but because it has a lot to do I really want another class to do
it called pageview.m. This is where I'm lost.
I can have AppController know about myView, pagefile and pageview but I
want to have myView know about pageview and call it's "show" function in
myView's "drawRect". So pageview is known by AppController and myView -
I'm totally stuck and confused about how to do this simply. Obviously
I'm missing the "big picture" somewhere.
Any help appreciated, thanks.
Paul
David Phillip Oster - 25 May 2006 02:23 GMT
> My app has a window with a myView, an AppController and my own class to
> read and write my data files.
[quoted text clipped - 16 lines]
> I'm totally stuck and confused about how to do this simply. Obviously
> I'm missing the "big picture" somewhere.
You'd probably be better off by starting again with the Cocoa document
app stationery, with a document class that has an outlet to its view.
But, if you want to keep going with your existing architecture, remember
that your view can always use:
[NSApp delegate]
to get a pointer to the AppController.
you might consider renaming pageview.m to imagedecal.m Then, it is
quite clean for myView's drawrect to ask the appController for an
appropriate imageDecal and tell it to draw itself.
The name change makes clear that imageDecal isn't a view itself, but if
something a view can use to draw an image.