Finding the right resources...

Discussion in 'Mac Programming' started by Tylox, Mar 20, 2008.

  1. Tylox macrumors newbie


    Feb 21, 2008
    San Jose, CA

    I am currently working my way through the Hillegass book and just finished the second challenge to Chapter 6, sorting a NSTableView without using Bindings or the NSController class.

    After spending approximately 2 evenings digging through the class reference documents at Apple, I narrowed down my search to one of three documents for the code I needed to implement:


    Creating and Using Sort Descriptors

    NSTableDataSource Protocol Reference

    This is where I got stuck. I understood that I somehow needed to implement sortDescriptors; however, since the class documentation only tends to list the method and a brief summary of what it does, I did not grasp how to connect sortDescriptors to my TableView.

    After getting frustrated with the Apple documentation, I started googling around for similar example code. I originally avoided this approach as I didn't want to accidently come across the answer. I wanted to figure out the logic behind the code I needed to insert...

    I found out the answer was, quite simply, to drop the following method in the myDocument class:

    - (void)tableView:(NSTableView *)aTableView sortDescriptorsDidChange:(NSArray *)oldDescriptors
    Now of course, as I am now writing this the day after the exersize, I realized WHY this works...delegates! (I should have realized this right away with the "...DidChange" syntax, but I'm still pretty new to this).

    My question is...I feel if the Apple documentation contained more details in their descriptions or links example code showing how to implement said code, I would have solved this puzzle much earlier. Is this mainly because I am still new to Cocoa programming, while an advanced programmer would instantly see that method and know exactly how to implement it? If not, what are some suggestions for further resources to learn this information?

    Thanks for your help!
  2. HiRez macrumors 603


    Jan 6, 2004
    Western US
    Oops, didn't see you found the more detailed docs...please delete this post.
  3. MacsAttack macrumors 6502a

    Jul 2, 2006
    May want to check out this site

    The podcasts work through the Hillegass book. May have some illuminating info.

Share This Page