• 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: Updating tracking areas Rect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating tracking areas Rect


  • Subject: Re: Updating tracking areas Rect
  • From: Graham Cox <email@hidden>
  • Date: Tue, 29 Dec 2009 20:50:25 +1100

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

  • Follow-Ups:
    • Re: Updating tracking areas Rect
      • From: Gustavo Pizano <email@hidden>
References: 
 >Updating tracking areas Rect (From: Gustavo Pizano <email@hidden>)
 >Re: Updating tracking areas Rect (From: Gustavo Pizano <email@hidden>)
 >Re: Updating tracking areas Rect (From: Joar Wingfors <email@hidden>)
 >Re: Updating tracking areas Rect (From: Gustavo Pizano <email@hidden>)
 >Re: Updating tracking areas Rect (From: Joar Wingfors <email@hidden>)
 >Re: Updating tracking areas Rect (From: Gustavo Pizano <email@hidden>)

  • Prev by Date: Re: Creating CoreData classes
  • Next by Date: Re: Updating tracking areas Rect
  • Previous by thread: Re: Updating tracking areas Rect
  • Next by thread: Re: Updating tracking areas Rect
  • Index(es):
    • Date
    • Thread