Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating subviews programmatically ?



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Creating subviews programmatically ? (From: Erik Buck <email@hidden>)
 >Re: Creating subviews programmatically ? (From: "I. Savant" <email@hidden>)
 >Re: Creating subviews programmatically ? (From: Scott Anguish <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.