• 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: NSOutlineView developer example
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView developer example


  • Subject: Re: NSOutlineView developer example
  • From: Marco Masser <email@hidden>
  • Date: Thu, 4 Sep 2008 09:36:58 +0200


so far so good. But when I change the "initWithPath" to "initWithPath:@"/Volumes/MyDisk/path/to/any/directory", as Ben said, i want the same behaviour like with the "/" only, but a tree from my path there. But this does not happen. Instead, i get a single row with the last path component with NO triange on the side, so this is kind of useless.


Does anyone know why this happens?

Erm... hi...

The problem is not the root path itself, but the -fullPath method:

- (NSString *)fullPath {
return result = parent ? [[parent fullPath] stringByAppendingPathComponent:relativePath] : relativePath;
}


If the fullPath of the root item should be returned, this just returns its relative path. This works because for "/", the full and the relative path are the same. If your root item should be /Users, the full path is "/Users", but the above method returns just "Users", therefore rendering all subsequent child item's paths useless. To get it working in a quick'n'dirty way, I tried the following (it works):

1) Add a new ivar called rootPath
2) In -initWithPath:parent: check whether the parten item passed is nil. If so, set the path passed as the rootPath
3) Modify the -fullPath method to look like this:


- (NSString *)fullPath {
return result = parent ? [[parent fullPath] stringByAppendingPathComponent:relativePath] : rootPath;
}



Marco _______________________________________________

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


References: 
 >NSOutlineView developer example (From: Boris Prohaska <email@hidden>)
 >Re: NSOutlineView developer example (From: Benjamin Stiglitz <email@hidden>)
 >Re: Re: NSOutlineView developer example (From: Boris Prohaska <email@hidden>)
 >Re: NSOutlineView developer example (From: Boris Prohaska <email@hidden>)
 >Re: NSOutlineView developer example (From: Graham Cox <email@hidden>)
 >Re: NSOutlineView developer example (From: Boris Prohaska <email@hidden>)

  • Prev by Date: clipView's boundsSize changes after scrollToPoint:
  • Next by Date: Re: Selection in NSCollectionView
  • Previous by thread: Re: NSOutlineView developer example
  • Next by thread: NSInteger
  • Index(es):
    • Date
    • Thread