• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating subviews programmatically ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating subviews programmatically ?


  • Subject: Re: Creating subviews programmatically ?
  • From: Vince Ackerman <email@hidden>
  • Date: Sat, 1 Dec 2007 09:59:31 -0800


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.



_______________________________________________

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


  • Follow-Ups:
    • Re: Creating subviews programmatically ?
      • From: Scott Ribe <email@hidden>
References: 
 >Re: Creating subviews programmatically ? (From: Vince Ackerman <email@hidden>)
 >Re: Creating subviews programmatically ? (From: Dave Hersey <email@hidden>)

  • Prev by Date: Re: Creating subviews programmatically ?
  • Next by Date: ImageKit + GC = nogo? (or better... how :D)
  • Previous by thread: Re: Creating subviews programmatically ?
  • Next by thread: Re: Creating subviews programmatically ?
  • Index(es):
    • Date
    • Thread