Skip navigation.
 
mlRe: Creating subviews programmatically ?
FROM : Dave Hersey
DATE : Sat Dec 01 18:22:32 2007

On Dec 1, 2007, at 11:51 AM, Vince Ackerman wrote:
> I put a NSLog () in the setFrameSize: override and it's only being 
> called once, so that wouldn't explain it.  The description dump of 
> the array each time through the resizeDayView method shows that it 
> is in fact switching the first and last item in the array:
>
>  <DayView: 0x13ba80>,    <----------------  this is the original 
> item zero
>    <DayView: 0x13dab0>,
>    <DayView: 0x13dce0>,
>  ........  37 more subView items ...
>    <DayView: 0x147650>,
>    <DayView: 0x147a60>  <----------------  this is the original 
> last item 41
>
>
> As the window continues its resize, the description dump shows it 
> alternates to this:
>
>
>    <DayView: 0x147a60>,  <----------------  this is the original 
> item 41
>    <DayView: 0x13dab0>,
>    <DayView: 0x13dce0>,
> ........  37 more subView items ...
>    <DayView: 0x147650>,
>    <DayView: 0x13ba80>  <----------------  this is the original 
> item zero, now at the end of the array
>
>
> This happens every other time through the resizeDayView method. 
> Strange huh?
>
> Next, I'll try getting rid of NSEnumerator as you suggest.  For the 
> life of me I can't see why the array is being switched.


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

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