Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't clear the entire drawing from the screen. #3

Closed
edwardinubuntu opened this issue Dec 10, 2010 · 1 comment
Closed

Can't clear the entire drawing from the screen. #3

edwardinubuntu opened this issue Dec 10, 2010 · 1 comment

Comments

@edwardinubuntu
Copy link
Owner

The user can shake the iPhone or press erase button, still can't clear the entire drawing from the screen.

After calling the resetView, self setNeedsDisplay will calling into drawRect method, but int the drawRect function haven't implement the clear the drawing yet.


- (void)resetView {
    [squiggles removeAllObjects];
    [finishedSquiggles removeAllObjects];
    [self setNeedsDisplay]; // refresh the display
}

// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code.
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    for (Squiggle *squiggle in finishedSquiggles)
        [self drawSquiggle:squiggle inContext:context];
    
    for (NSString *key in squiggles) {
        Squiggle *squiggle = [squiggles valueForKey:key];
        [self drawSquiggle:squiggle inContext:context];
    }
}
@edwardinubuntu
Copy link
Owner Author

After remove unwanted UIView, and use the original MainView instead. The bug fixed after tested.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant