Re: Creating subviews programmatically ?
Re: Creating subviews programmatically ?
- Subject: Re: Creating subviews programmatically ?
- From: Erik Buck <email@hidden>
- Date: Mon, 26 Nov 2007 11:59:55 -0800 (PST)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden