NSScrollView右下角的处理
来源:互联网 发布:最好吃的方便面 知乎 编辑:程序博客网 时间:2024/05/22 15:44
@interface MyScrollView : NSScrollView { } @end @implementation MyScrollView - (void)drawRect:(NSRect)rect{ [super drawRect: rect]; if([self hasVerticalScroller] && [self hasHorizontalScroller]) { NSRect vframe = [[self verticalScroller]frame]; NSRect hframe = [[self horizontalScroller]frame]; NSRect corner; corner.origin.x = NSMaxX(hframe); corner.origin.y = NSMinY(hframe); corner.size.width = NSWidth(vframe); corner.size.height = NSHeight(hframe); // your custom drawing in the corner rect here [[NSColor redColor] set]; NSRectFill(corner); } } @end