문제

How can I set blue background for every second row in NSOutlineView, like it does Finder.app?

도움이 되었습니까?

해결책

NSOutlineViewis a subclass of NSTableViewand thus inherits the method setUsesAlternatingRowBackgroundColors:

If you send a YES to it, you get alternating background colors.

다른 팁

You can subclass NSOutlineView and do some drawing in

- (void)drawRow:(NSInteger)rowIndex clipRect:(NSRect)clipRect

Also have a look at other drawing methods available in TableView. You can also make use of the delegate method i.e

- (void) outlineView:(NSOutlineView*)view willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn item:(id)item
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top