1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

NSOutlineView Group Item

Discussion in 'Mac Programming' started by hazkid, Apr 11, 2008.

  1. macrumors newbie

    I would like to implement a Finder/iTunes sidebar for my app. I have an NSOutlineView with a data source and everything, except I can't seem to implement the outlineView:isGroupRow: delegate method. I've tried returning yes for all items, identifying by index, string value, and nothing seems to work. The outline view is in IB with highlight style "source list" (for the active blue/inactive gray background).
    The examples on Apple.com (SourceView and DragNDropOutlineView) are so complex I can't navigate through them - they're designed for higher level programmers than me. All of their data is loaded from the system, resulting is tons of code that I simply can't wade through.

    I can't believe something like this could be so difficult. There are virtually no examples on the web, either- most of them were written before Leopard, using special backgrounds and gradients for the highlighting.

    Thanks in advance to anyone who can lead me in the right direction with this.
  2. Moderator emeritus


    Make sure you have the outline view's delegate set, since outlineView:isGroupRow: is a delegate method, not a datasource method.

    Edit: here's a sample project I whipped up to demonstrate. I tried to keep it as bare minimum as possible.

    Attached Files:

  3. macrumors newbie

    Wow. That sample project was incredible. It was simple enough to read! Thank you so much.

    I had tried setting the delegate before, but it made my app crash, so I disconnected it, thinking "well, this can't be it".

    But everything works great now.
  4. Moderator emeritus


    I always find it amazing that Apple's examples are so overly complex.

    I've always wanted to start a site that hosts very basic sample projects that demo Cocoa features, but just haven't gotten around to it. Maybe soon ;)

    Great! Glad it's working.
  5. macrumors newbie

    That's a great idea. Its so hard to find simple, focused Cocoa examples online.

Share This Page