Well, do you actually erase them?

The drawRect: method usually starts with something that paints the background colour - if you don't do that then any pixels previously drawn are not cleared.

e.g.:


- (void) drawRect:(NSRect) rect
{
        [[NSColor whiteColor] set];
        NSRectFill( rect );

        // the rest of the drawing code...
}


hth,

Graham




On 23 Jul 2008, at 8:03 am, JArod Wen wrote:

Hi,

I met a problem on clearing points and paths on a customized NSView. I set four NSBezierPath for drawing: pathForPositionMeasure, pathForDistanceMeasure, pathForAngleMeasure and selectedPath, and used the following code for clearing:

                [pathForPositionMeasure removeAllPoints];
                [pathForDistanceMeasure removeAllPoints];
                [pathForAngleMeasure removeAllPoints];
                [selectedPath removeAllPoints]; 
                [self setNeedsDisplay:YES];

And the drawRect is only contained the code to draw these four paths. But after these lines are executed, points and paths are still there on the view. Is there any way to clear them?

Thanks in advance!
---------------
JArod Wen

_______________________________________________

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