在NSOutlienView中,如果要定制那个expand和collapse的三角(disclosure triangle, 可以重写NSView的didAddSubview方法,子类NSTableRowView,覆盖方法didAddSubview, 下面贴代码
-(void)didAddSubview:(NSView *)subview
{
// As noted in the comments, don't forget to call super:
[super didAddSubview:subview];
if ( [subview isKindOfClass:[NSButton class]] ) {
// This is (presumably) the button holding the
// outline triangle button.
// We set our own images here.
[(NSButton *)subview setImage:[NSImage imageNamed:@"disclosure-closed"]];
[(NSButton *)subview setAlternateImage:[NSImage imageNamed:@"disclosure-open"]];
}
}