FROM : Vince Ackerman
DATE : Sat Dec 01 17:51:02 2007
>
> Have you tried avoiding the enumerator entirely and just using
> another index var and objectAtIndex: to read the subDayViews array?
> I'm having trouble believing that this is a problem with
> NSEnumerator... I have a feeling your array is not what you expect.
> In fact, if you haven't already, I'd try dumping the array's
> description to the log.
>
> The only other thing I can think of is that maybe you've got this
> code in the class for the views that you're working on, and your
> call to
>
> [ tempView setFrame: newRect ]
>
> is causing your setFrameSize override to be called, which is calling
> resizeDayViews again, giving you misleading log statements and
> general chaos. In other words, are you sure you're not reentering
> the method because of that setFrame call in the loop (or something
> else)? I have no idea if setFrame causes the setFrameSize override
> to be called, but it wouldn't surprise me. You may want to log entry
> and exit for the method, or step through the loop in the debugger.
>
> Anyway, just some late night thoughts that may or may not help.
>
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.
Thanks
Vince
DATE : Sat Dec 01 17:51:02 2007
>
> Have you tried avoiding the enumerator entirely and just using
> another index var and objectAtIndex: to read the subDayViews array?
> I'm having trouble believing that this is a problem with
> NSEnumerator... I have a feeling your array is not what you expect.
> In fact, if you haven't already, I'd try dumping the array's
> description to the log.
>
> The only other thing I can think of is that maybe you've got this
> code in the class for the views that you're working on, and your
> call to
>
> [ tempView setFrame: newRect ]
>
> is causing your setFrameSize override to be called, which is calling
> resizeDayViews again, giving you misleading log statements and
> general chaos. In other words, are you sure you're not reentering
> the method because of that setFrame call in the loop (or something
> else)? I have no idea if setFrame causes the setFrameSize override
> to be called, but it wouldn't surprise me. You may want to log entry
> and exit for the method, or step through the loop in the debugger.
>
> Anyway, just some late night thoughts that may or may not help.
>
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.
Thanks
Vince






Cocoa mail archive

