0
votes

I have two tables (NSTableView) on a window. Well, the number is irrelevant. Anyway, the source of the first table (tableView1) is NSMutableArray with NSMutableDictionary. And I have the following code.

- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView {
    if (aTableView == tableView1) {
        return [itemArray1 count];
    } else {
        ...
    }
}

- tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)TableColumn row:(NSInteger)rowIndex {
    // tableView1
    if (aTableView == tableView1) {
        NSString *foldername = [[itemArray1 objectAtIndex:rowIndex] objectForKey:key1a];
        NSString *count = [[itemArray1 objectAtIndex:rowIndex] objectForKey:key1c];
        if ([[TableColumn identifier] isEqualToString:@"folder"]) {
            return foldername;
        }

        if([[TableColumn identifier] isEqualTo:@"count"]){
            return count;
        }

        else {
            return @"";
        }

    // tableView2
    } else {
        ...
    }
}

I get what I want, and the second column shows the number of items (count). I wonder how I can possibly draw this number like the SidebarDemo example project? (Shown at the bottom...) This project utilizes - (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item to show a static number (42). Can I show the number like that with NSTableView as well? I could just draw a circled number if it were an iOS application.

Thank you for your advice.

enter image description here

1
All righty. I got it by actually drawing a rounded rectangle with numbers just as I do with iOS apps.El Tomato

1 Answers

1
votes

tableView:viewForTableColumn:row: (NSTableViewDelegate) should work similar.