• 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
Method Recursion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Method Recursion


  • Subject: Method Recursion
  • From: Ron Jenkins <email@hidden>
  • Date: Tue, 6 Jun 2006 13:33:32 -0400

James Bucanek wrote:

Jeremy's correct. But I will point out one quirk about expandItem:expandChildren:. While it's behaviour is recursive, the method itself it not. That is, it doesn't call itself with each child that its going to expand or collapse.

I discovered this fact when overriding the method in attempt to short- curcuit its normal behavior. I have an outline browser that could potentially expand to millions of records, each of which must be read from a database. Allowing the user to option-click one of the top- level nodes would have been a disaster. I thought that I could override this and allow one or two levels of children to be expanded, but change the expandChildren: argument to NO for anything deeper than that -- but it doesn't work that way.

--

I'm a little new to OOP but maybe the part where the method calls itself shouldn't be capable of being overridden? Otherwise you couldn't change the method internally without breaking code, in this case changing from recursion to a loop.

Ron

PS I'm at work or else I'd test it.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: crash when using notification center and self
  • Next by Date: Re: Fastest way to "ExpandAll" in NSOutlineView
  • Previous by thread: Re: Extending the save dialog?
  • Next by thread: vertically aligning my NSAttributed text in its NSRect when drawn
  • Index(es):
    • Date
    • Thread