Aaron Hillegass Chapter 18 Challenge Question
Posted
by jasonbogd
on Stack Overflow
See other posts from Stack Overflow
or by jasonbogd
Published on 2010-06-14T18:07:57Z
Indexed on
2010/06/15
2:22 UTC
Read the original article
Hit count: 565
I am working through Aaron Hillegass' Cocoa Programming for Mac OS X and am doing the challenge for Chapter 18. Basically, the challenge is to write an app that can draw ovals using your mouse, and then additionally, add saving/loading and undo support. I'm trying to think of a good class design for this app that follows MVC. Here's what I had in mind:
Have a NSView-subclass that represents an oval (say JBOval) that I can use to easily draw an oval. Have a main view (JBDrawingView) that holds JBOvals and draws them.
The thing is that I wasn't sure how to add archiving. Should I archive each JBOval? I think this would work, but archiving an NSView doesn't seem very efficient. Any ideas on a better class design?
Thanks.
© Stack Overflow or respective owner