Skip navigation.
 
mlRe: Creating subviews programmatically ?
FROM : Vince Ackerman
DATE : Fri Nov 30 18:49:50 2007

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

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