Coloring rows in View based NSTableview

后端 未结 4 1524
清酒与你
清酒与你 2021-02-12 17:26

I have a view based nstableview. I want to color entire row based on some condtion for which I have used code below

- (NSTableRowView *)tableView:(NSTableView *)         


        
4条回答
  •  醉酒成梦
    2021-02-12 18:30

    If you watch the presentation on view based tableviews from WWDC 2011, you'll see that the main idea is to create the views in Interface Builder, and then obtain them from there. Something like:

    [tableView makeViewWithIdentifier:@"GroupRow" owner:self];
    

    Once you have obtained the view, just set its properties and return it.

    Notice in this example that it has its own identifier, so remember to set that, but you can also used automatic identifiers.

    I don't know if a direct link to the WWDC will work, but the main page is here: https://developer.apple.com/videos/wwdc/2011/ and if you search for "View Based NSTableView Basic to Advanced", you'll find it. It is well worth watching.

提交回复
热议问题