Re: Creating subviews programmatically ?
Re: Creating subviews programmatically ?
- Subject: Re: Creating subviews programmatically ?
- From: Vince Ackerman <email@hidden>
- Date: Fri, 30 Nov 2007 09:49:50 -0800
Greetings,
Can NSView re-order it's array of subviews without notice?
I'll try to explain my problem with out sounding like the total newbie
that I am...
I've programmatically created a (calendar type) grid of sub-classed
subviews in my main view, and assigned each one a number (to keep
track of them). There are 42 subviews, numbered 0 - 41.
They all display and draw correctly and in order in the main view.
However, when I resize the window, I've found an odd problem.
When the main view gets a "setFrameSize" call, I override it and call
a method to re-size the subview frames. This method uses NSEnumerator
to step through the NSArray returned by "subViews" and recalculates
and calls setFrame on each subview.
For some reason each time the resizeSubview method is called,
NSEnumerator alternately returns with either the first subview in the
array, or the last. The first time the method is called, the first
subview is number 0, continuing through 41. The next time it goes
through the array, the enumerator starts with subview 41, skips
subview 0, and iterates to subview 1, then 2, 3 etc.
I'm doing nothing more than changing the frameRect of each subview, so
I can't understand why the array is changing order.
Could someone clue me in?
Thanks,
Vince
_______________________________________________
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