Skip navigation.
 
mlRe: Creating subviews programmatically ?
FROM : Vince Ackerman
DATE : Sat Dec 01 18:59:31 2007

On Dec 1, 2007, at 09:22, Dave Hersey wrote:
>
>
> Well, by the descriptions you're showing, it looks like NSEnumerator 
> is working correctly and you'll see the same thing from 
> objectAtIndex. It must be something about how the subviews are dealt 
> with by the system during resizing. There's no guarantee about the 
> order in which subviews are drawn, and there may be no guarantee 
> about the order they're kept in either. You're probably better off 
> just creating an array of these view objects in the order you want 
> at awakeFromNib or the like, and using that during the resize. That 
> way you don't have to depend on the system maintaining your ordering.
>
> - d
>
> _______________________________________________




Yeah, it looks like NSView is re-ordering the array even though Apples 
Docs suggest they are in a fixed order and you not modify the subview 
array. I guess I could tell the array to sort by the gridNum variable 
I've assigned when each was initialized, then setFrame?

Here's the docs on the subviews message:

subviews
Return the receiver’s immediate subviews.

- (NSArray *)subviews

Discussion
The order of the subviews may be considered as being back-to-front, 
but this does not imply invalidation and drawing behavior. The order 
is based on the order of the receiver's subviews as specified in the 
nib file from which they were unarchived or the programmatic interface 
for modifying the receiver's subview list. This ordering is also the 
reverse of the order in which hit-testing is done.

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