Binding WebView in Core Data app

Discussion in 'Mac Programming' started by ace2600, Apr 13, 2009.

  1. macrumors member

    Joined:
    Mar 16, 2008
    Location:
    Austin, Texas
    #1
    I have a basic Core Data application for an array of Jobs displayed in an NSTableView. I want to add a WebView that will load the string inside the job.htmlSummary attribute for the selected item in the table view (job is my entity). If I use an NSTextField, I can simply use "Bind To: Jobs" for Value in the bindings inspector with Model key path set to htmlSummary.

    However, I have no idea how to do this for the WebView. I know the code would be something like
    Code:
    [[webView mainFrame] loadHTMLString:selectedItem.htmlSummary baseURL:myUrl];
    But I do not know how to call this every time the selection changes. Or how that binding works.

    P.S. I am using Hillegass's chapter on creating a Core Data document application as the inspiration. CarLot is the example.
     
  2. thread starter macrumors member

    Joined:
    Mar 16, 2008
    Location:
    Austin, Texas
    #2
    After thinking about the problem more, I'm really just after a way to be notified when the selection changes. I can load the HTML into the WebView and everything programmatically after that.

    How can I run an action on every selection change in the NSTableView?
     
  3. macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #3
    NSTableViewSelectionDidChangeNotification is what you're looking for I think.
     

Share This Page