You need to use a pattern image as Kurt pointed out, but it's not as simple as that. Pattern images use the window's origin as their origin point, so if you resize the window the pattern will move.
You need to adjust the pattern phase in the current graphics context depending on where the view sits in the window. I use this category on NSView:
@implementation NSView (RKAdditions)
- (void)rk_drawPatternImage:(NSColor*)patternColor inRect:(NSRect)rect
{
[self rk_drawPatternImage:patternColor inBezierPath:[NSBezierPath bezierPathWithRect:rect]];
}
- (void)rk_drawPatternImage:(NSColor*)patternColor inBezierPath:(NSBezierPath*)path
{
[NSGraphicsContext saveGraphicsState];
CGFloat yOffset = NSMaxY([self convertRect:self.bounds toView:nil]);
CGFloat xOffset = NSMinX([self convertRect:self.bounds toView:nil]);
[[NSGraphicsContext currentContext] setPatternPhase:NSMakePoint(xOffset, yOffset)];
[patternColor set];
[path fill];
[NSGraphicsContext restoreGraphicsState];
}
@end
You'd use it like this:
-(void) drawRect: (NSRect)dirtyRect
{
[self rk_drawPatternImage:[NSColor colorWithPatternImage:yourImage] inRect:self.bounds];
}