Re: Updating tracking areas Rect
Re: Updating tracking areas Rect
- Subject: Re: Updating tracking areas Rect
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 29 Dec 2009 11:01:43 +0100
I did change the loop yesterday. and now its working ok...
> The rest of the discussion was off on a bit of a tangent - how best to write that loop.
the same was with me in todays post. . ;-)
Still Im having problems when dragging I need to be very precise when clicking the first time.. must check that also.
Thanks a lot
G.
On Dec 29, 2009, at 10:50 AM, Graham Cox wrote:
>
> On 29/12/2009, at 7:37 PM, Gustavo Pizano wrote:
>
>> Yes, the view is the only one adding the TA, when I resize the view by dragging, as far as I understand, the updateTrackingAreas method its called, so I overwrote that method deleting the old ones and calculating the new ones. Maybe what graham says must be done, copy the collection and iterate that but delete the "right one"
>>
>> Im gonna give it a try , 'ill let you know.
>
>
> You do realise that the problem is what Joar pointed out, that the loop that deletes your old tracking areas is not working, because its "terminating" condition is == 0, so it never runs at all?
>
> NSInteger i = 0;
> while ([[self trackingAreas] count]==0) // if there are any tracking areas, this loop will never run.
> // If there are not, it will throw an out-of-bounds // bounds exception because there is no element '0'.
>
> {
> [self removeTrackingArea:[[self trackingAreas] objectAtIndex:i]];
> i++;
> }
>
> The rest of the discussion was off on a bit of a tangent - how best to write that loop. But however you do it, the fundamental bug here is the while( <count> == 0 ), which explains the symptoms you described.
>
> By the way, setting a breakpoint just here and stepping through in the debugger would have made it immediately obvious what the problem was.
>
> --Graham
>
>
_______________________________________________
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