yuhao
yuhao

Reputation: 199

How can I make the Table View non-editable in Cocoa

I dragged a Table View from the library, and linked the datasource and delegate, it worked. But when the Application is running, I can double click the row in the table, and actually put some words in it. I just want it to be non-editable. What should I do?

Upvotes: 0

Views: 778

Answers (2)

NewStack
NewStack

Reputation: 990

You can just uncheck the Editable button in table column attributes in xib file. enter image description here

Upvotes: 1

nkongara
nkongara

Reputation: 1229

Implement the following delegate method that will return NO

- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
    return NO;
}

Upvotes: 1

Related Questions