Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我打算在 NSScrollView 中使用不适合顶部和底部边缘的 NSOutlineView,因为我需要在顶部和底部滚动边缘插入阴影(重叠渐变)。大纲视图应该可以在垂直的顶部阴影下方和底部阴影上方滚动。怎么可能实现?非常感谢!
我不太确定如何为顶部阴影获取空间,但为底部阴影实现它的核心是子类化NSOutlineView和覆盖setFrameSize::
NSOutlineView
setFrameSize:
- (void)setFrameSize:(NSSize)newSize { newSize.height += kBottomShadowHeight; [super setFrameSize:newSize]; }
您可以使用类似的技巧setFrameOrigin:在顶部获得一些空间,但我不太确定这会奏效。
setFrameOrigin: