• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Odd redraw issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Odd redraw issue


  • Subject: Re: Odd redraw issue
  • From: Matt Neuburg <email@hidden>
  • Date: Thu, 13 Jul 2006 08:51:33 -0700
  • Thread-topic: Odd redraw issue

On Thu, 13 Jul 2006 22:58:19 +1000, Gideon King <email@hidden> said:
>Hi, I have a problem in that drawing a pattern image in a view which
>is in a scroll view makes a mess when the view is scrolled. I created
>a test project and made a custom view, made it a subview of a
>scrollview, and put an image in my project and the only code I had in
>the custom view was the following:
>
>- (void)drawRect:(NSRect)rect {
> [[NSColor whiteColor] set];
> NSRectFill(rect);
> NSColor *tempColor = [NSColor colorWithPatternImage:[NSImage
>imageNamed:@"myImage"]];
> [tempColor set];
> [NSBezierPath fillRect:rect];
>}
>
>And the view is still messed up when I scroll with bits of the image
>being drawn over one another. I tried changing the references to
>"rect" to [self bounds] but it made no difference.

<http://www.cocoabuilder.com/archive/message/2005/3/15/130496>

In other words, don't keep creating the color in your drawRect. Create it
once and store it in an NSImage, and use *that* in your drawRect.

m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Array of random, non-repeating numbers
  • Next by Date: Re: DVDPlayback
  • Previous by thread: Odd redraw issue
  • Next by thread: Application dock icon problem
  • Index(es):
    • Date
    • Thread