Assuming you are using an NSTableViewDataSource
, you need to implement three methods:
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
When you click on the flag, the first method is called. If aTableColumn has your checkboxes, you will save a new state, which is [anObject boolValue]
.
When a table needs to draw a row, it calls the second method. When the table column is your checkbox column, return the state that you saved in the first method.
The last method tells the table how many rows there will be.
See the table data source documentation for more details, but I gave it briefly here.
source share