Shaving a couple levels of indentation off of an NSOutlineView

本秂侑毒 提交于 2019-12-05 07:13:51

The solution is to use frameOfCellAtColumn:row: which is an NSTableView method.

- (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row;
{
    NSRect frame = [super frameOfCellAtColumn:column row:row];

    if (column == (NSInteger)[self.tableColumns indexOfObjectIdenticalTo:self.outlineTableColumn]) {
        if (this-item-or-row-matches-your-conditions) {
            frame.origin.x -= self.indentationPerLevel;
            frame.size.width += self.indentationPerLevel;
        }
    }

    return frame;
}

This method controls the layout in both cell-based and view-based table views and outline views.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!