NSTableView get selected row data

Discussion in 'Mac Programming' started by cpuin, Sep 13, 2013.

  1. cpuin macrumors member

    Feb 3, 2013
    I want to get the data of NSTableView selected row.But i need to access the Core data data corresponding of the selected row.

    i only know how to get the selected row, but not the corresponding data.

     NSInteger selectedRow = [_contragentSheetTableView selectedRow];
        if (selectedRow >= 0) {
            NSLog(@"The selected row is %li", selectedRow);
        else {
            NSLog(@"No row was selected");
  2. devilofspades macrumors member

    Jul 20, 2011
    first off, you should never be accessing "_instanceVarName" directly unless in your init method or inside your custom accessors. instead you should be using "self.instanceVarName". as far as the answer to your question, it depends how you are populating the data from coredata into your tableview. you should have some tabelview delegate methods for filling in your tableview. what is your tableview data source tied to? is it hooked up to your cd datebase? does your tableview actually populate the data you are after or are you not at that point yet?
  3. cpuin thread starter macrumors member

    Feb 3, 2013
    My NSTableView populate core data Entity.

Share This Page