On 10 Oct 2008, at 7:17 am, DKJ wrote:

- (void)mouseDown:(NSEvent *)ev {
        
        click = [self convertPoint:[ev locationInWindow] fromView:nil];
        [self display];
}


Don't call [self display]. Instead, call [self setNeedsDisplay:YES]; While the above will work, it's not the recommended way to update the view.

- (void)drawRect:(NSRect)rect {
        
        NSImage *board = [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"chessboard" ofType:@"tiff"]];
        
        [board drawInRect:[self bounds]
                         fromRect:NSZeroRect
                        operation:NSCompositeSourceOver
                         fraction:0.5];
        
***     [str drawAtPoint:click withAttributes:dict];
}


This is leaking the 'board' image every time you draw it. You need to move the loading of the board image elsewhere - the -initWithFrame: method would probably be a good place - then you can redraw the same object in -drawRect:

hth,

Graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to