You can make use of
+ (NSColor *)colorWithPatternImage:(NSimage *)image
and fill the rect with the color .
[[NSColor colorWithPatternImage: patternedImage] set];
[NSBezierPath fillRect:yourRect];
سؤال
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?
Any kind of help is highly appreciated!
المحلول
You can make use of
+ (NSColor *)colorWithPatternImage:(NSimage *)image
and fill the rect with the color .
[[NSColor colorWithPatternImage: patternedImage] set];
[NSBezierPath fillRect:yourRect];
نصائح أخرى
Yes — just create an NSColor with a pattern image and fill with that color.