NSScrollView右下角的处理

转自:http://blog.csdn.net/abby_sheen/article/details/7179209


  1. @implementation MyScrollView    
  2. - (void)drawRect:(NSRect)rect  
  3. {       
  4.       [super drawRect: rect];        
  5.       if([self hasVerticalScroller] && [self hasHorizontalScroller])  
  6.         {           
  7.              NSRect vframe = [[self verticalScroller]frame];           
  8.              NSRect hframe = [[self horizontalScroller]frame];           
  9.              NSRect corner;           
  10.              corner.origin.x = NSMaxX(hframe);           
  11.              corner.origin.y = NSMinY(hframe);           
  12.              corner.size.width = NSWidth(vframe);           
  13.              corner.size.height = NSHeight(hframe);           
  14.               // your custom drawing in the corner rect here           
  15.              [[NSColor redColor] set];           
  16.              NSRectFill(corner);   
  17.        }   
  18. }   
  19. @end

你可能感兴趣的:(NSScrollView右下角的处理)