Finding the right resources...

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

  1. macrumors newbie

    Tylox

    Joined:
    Feb 21, 2008
    Messages:
    10
    Location:
    San Jose, CA
    #1
    Howdy,

    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:

    NSSortDescriptor

    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:

    Code:
    - (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. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Messages:
    4,861
    Location:
    Western US
    #2
    Oops, didn't see you found the more detailed docs...please delete this post.
     
  3. macrumors 6502a

    Joined:
    Jul 2, 2006
    Messages:
    829
    Location:
    Scotland
    #3
    May want to check out this site

    http://cocoacast.com/

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

Share This Page