문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top