So, I’m plugging along in my StudioScheduler app, coming up with concepts and figuring out techniques I’ll need to use to bring the whole thing together. Right now, I’m trying to figure out the most important aspect of the user interface–the grid. What I’m going for is a time-grid, something like what iCal displays on the weekly view. When you click in a certain region, it changes color for that half-hour on that day, and sends a message to the app. I’m thinking an NSMatrix with a bunch of NSButtons is the way to go, but I really want it to look like that grid and not a bunch of buttons. I’m guessing I’m going to have to use some kind of custom view to achieve that. Also, I’d like it to stretch/compress when the window is resized, like iCal’s does. Ooh, which gives me an idea for an awesome new feature–the ability to export completed schedules as an iCal calendar. Rock. Oh well, back to the book.



Based on what your talking about I can assure you you’ll definitely need to do some NSView customization. First off IDK if anybody has done this, but it’s worth it to search CocoaDev for iCal views or anything related installing iCal functionality into your own app.
Idk how iCal’s view works but there are a couple of approaches to this, but I think the easiest approach would be to use 2 views. I’m using NM (nick m) for the prefix but feel free to change the names as you like
(1) NMCalendarPresentationManagerView
This view is a container for a matrix of subviews, it’s responsible for appropriately managing the subviews and getting them to draw at the appropriate locations, properly removing and dealloc’ing the subviews as necessary.
(2) NMCalendarMonthDayView
This view is where you actually see events in and can click on them as appropriate, it registers itself for a drag type to allow dragging of events between the other views and keeps track of the events as passed to it (perhaps in a NSMutableArray.) It also appropriately removes/deallocs events as passed to it and dealloc’s itself as necessary.
(3) NMCalendarEventOvalView
This one is technically unessessary but can allow you to clone some of that iCal feel by handling onClick events to draw a shadow, delete key down events, drawing a custom color, custom fonts, etc.
If all this sounds very complicated it’s not as complicated as im making it out to sound. It’s important to have a decent level of abstraction between different parts of this view to enable reuse and easily allow you to change things around should you need to. Remember CocoaDev is your friend
Good luck and if you need any help don’t be afraid to ask!