Pergunta

I sorted the NSTableColumn using the sort descriptors. I used the following code for Sorting.

 NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"Column3" ascending:NO];
        NSArray *sortDescriptors= [NSArray arrayWithObject:sortDescriptor];
        [self.dataArray sortUsingDescriptors:sortDescriptors];

[tableView setIndicatorImage:[NSImage imageNamed:@"NSAscendingSortIndicator"]
                          inTableColumn:[tableView tableColumnWithIdentifier:@"Column3"]]; 

I am able to get the image from [NSImage imageNamed:@"NSAscendingSortIndicator"],but Iam not able to view the image in the tableview header.

Is there any way to simulate the mouse click on the table column to get that Sort indicator(up or down arrow in the table header) in the table column.

Foi útil?

Solução

Following Code will update the Sort indicator with out clicking on the header.

[self.tableView setSortDescriptors:sortDescriptors];
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top