Skip navigation.
 
mlRe: Creating subviews programmatically ?
FROM : Erik Buck
DATE : Mon Nov 26 20:59:55 2007

I disagree with the previous answers.  I see no problem with 31 subviews from a performance perspective.  Things like cursor rects and event handling will be nicer and simpler if each "day" is its own view.
 
  I would create a MYCalendarView class that uses a template MYDayControl instance.  The MYCalendarView copies the template MYDayControl instance as many times as needed to populate the calendar.  MYCalendarView should have a -tile method that repositions and re-sizes the MYDayControl instances as needed.  Create the template MYDayControl instance in Interface Builder so that days can bee structured however you want...the MYCalendarView class is reusable with multiple different kinds of MYDayControls.  MYCalendarView could show a work-week or a whole month or a single day and use different specialized MYDayControl instance for each style...
 
  This opens lots of cool possibilities such as CoreAnimation effects to indicate selection.  The user double clicks a day and it zooms to fill the whole MYCalendarView with a nice animation... moving tasks or events within a day or from day to day could use standard NSView support for drag and drop.  Each MYCalendarView instance could preserve a cached snapshot of itself so that if multiple months are shown at the same time, each moth would look like a miniature preview of itself the same way document icons in the dock show a preview...
 
  You might even be able to make this work using the now standard NSCollectionView.
  http://developer.apple.com/documentation/Cocoa/Reference/NSCollectionView_Class/Introduction/Introduction.html

Related mailsAuthorDate
mlCreating subviews programmatically ? Vince Ackerman Nov 26, 17:18
mlRe: Creating subviews programmatically ? j o a r Nov 26, 17:27
mlRe: Creating subviews programmatically ? I. Savant Nov 26, 17:31
mlRe: Creating subviews programmatically ? Vince Ackerman Nov 26, 17:59
mlRe: Creating subviews programmatically ? Erik Buck Nov 26, 20:59
mlRe: Creating subviews programmatically ? I. Savant Nov 26, 21:35
mlRe: Creating subviews programmatically ? Scott Anguish Nov 27, 02:16
mlRe: Creating subviews programmatically ? Ricky Sharp Nov 27, 02:55
mlRe: Creating subviews programmatically ? I. Savant Nov 27, 02:57
mlRe: Creating subviews programmatically ? Vince Ackerman Nov 27, 16:32
mlRe: Creating subviews programmatically ? Vince Ackerman Nov 30, 18:49
mlRe: Creating subviews programmatically ? Vince Ackerman Nov 30, 18:54
mlRe: Creating subviews programmatically ? Vince Ackerman Nov 30, 19:04
mlRe: Creating subviews programmatically ? Vince Ackerman Nov 30, 19:18
mlRe: Creating subviews programmatically ? Vince Ackerman Dec 1, 06:46
mlRe: Creating subviews programmatically ? Dave Hersey Dec 1, 07:21
mlRe: Creating subviews programmatically ? Vince Ackerman Dec 1, 17:51
mlRe: Creating subviews programmatically ? Dave Hersey Dec 1, 18:22
mlRe: Creating subviews programmatically ? Vince Ackerman Dec 1, 18:24
mlRe: Creating subviews programmatically ? Vince Ackerman Dec 1, 18:59
mlRe: Creating subviews programmatically ? Vince Ackerman Dec 2, 13:35
mlRe: Creating subviews programmatically ? Scott Ribe Dec 4, 23:47