0

I'm curious if I can draw a NSRect using NSBezierPath and then fill it with some striped pattern so it looks something like the picture below?

enter image description here

Any kind of help is highly appreciated!

Eugene Gordin
  • 4,047
  • 3
  • 47
  • 80

2 Answers2

6

You can make use of

+ (NSColor *)colorWithPatternImage:(NSimage *)image

and fill the rect with the color .

[[NSColor colorWithPatternImage: patternedImage] set];
[NSBezierPath fillRect:yourRect];
nkongara
  • 1,233
  • 8
  • 14
0

Yes — just create an NSColor with a pattern image and fill with that color.

Chuck
  • 234,037
  • 30
  • 302
  • 389
  • Thank you so much Chuck! Would you mind elaborate a little bit more, I'm not that proficient with cocoa development yet?! – Eugene Gordin Dec 03 '13 at 20:07