Guest User

Untitled

a guest
Oct 21st, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @implementation customContentView
  2.  
  3. - (void)drawRect:(NSRect)dirtyRect
  4. {
  5.     NSRect drawRect = [self bounds];
  6.     NSGraphicsContext *context = [NSGraphicsContext currentContext];
  7.    
  8.     //set color
  9.     [[NSColor colorWithPatternImage:[NSImage imageNamed:@"WindowPattern.jpg"]] setFill];
  10.     //[[NSColor blackColor] setStroke];
  11.    
  12.     //rounded rectangle
  13.     [context saveGraphicsState];
  14.     NSRectFill(drawRect);
  15.    
  16.     [context restoreGraphicsState];
  17. }
  18.  
  19. - (void)setFrame:(NSRect)frameRect
  20. {
  21.     [super setFrame:frameRect];
  22.    
  23.     self.wantsLayer = YES;
  24.     self.layer.masksToBounds = YES;
  25.     self.layer.cornerRadius = RADIUS;
  26. }
  27.  
  28.  
  29. @end
Add Comment
Please, Sign In to add comment