Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cpuin

macrumors member
Original poster
Feb 3, 2013
77
0
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.

Code:
 NSInteger selectedRow = [_contragentSheetTableView selectedRow];
    
    if (selectedRow >= 0) {
        
        NSLog(@"The selected row is %li", selectedRow);
        
    }
    else {
        NSLog(@"No row was selected");
    }
 

devilofspades

macrumors member
Jul 20, 2011
76
0
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?
 

cpuin

macrumors member
Original poster
Feb 3, 2013
77
0
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?

My NSTableView populate core data Entity.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.