Re: Creating subviews programmatically ?
Re: Creating subviews programmatically ?
- Subject: Re: Creating subviews programmatically ?
- From: Scott Anguish <email@hidden>
- Date: Mon, 26 Nov 2007 20:16:38 -0500
On Nov 26, 2007, at 3:35 PM, I. Savant wrote:
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 disagree with your disagreement and raise you a pedantic
correction. ;-)
<shakes his head and backs slowly away from the crazy man>
I still tend to think of the calendar itself as a control and the
days as cells. There's nothing stopping you from using
"core-layer-animated-backed-views" ( :-P ) in the scenarios you've
suggested, but I can't disagree that it'd be easier to use a prototype
view and perhaps an NSCollectionView.
I don't think NSCollectionView is the way to go here. You'd need to
pad it with some empty views for the leading and trailing 'other
month' days.
Erik is right that views for each day would be the simplest way to
implement it.
You may think of it as a single control with cells, but you really
don't get any advantage from abstracting the days out as cells. You'd
not re-use a day cell on its own, for example in a table or matrix. So
you're adding complexity. As a result, I don't know that it'd be worth
the extra effort.
You could distribute IdiotCalendarView* that still uses
IdiotCalendarDayView for each of the underlying days but provides an
API that makes it unnecessary to be aware of, or deal with, the
underlying subviews
*I'm assuming you prefix all your classes with the unique "Idiot"
prefix.. [now who's joking? :-)]
_______________________________________________
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