• 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: white screen windows at first
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: white screen windows at first


  • Subject: Re: white screen windows at first
  • From: Graham Cox <email@hidden>
  • Date: Thu, 29 Apr 2010 11:23:08 +1000

On 29/04/2010, at 4:29 AM, Bill Appleton wrote:

> so is it "legal" to draw on an NSWindow from some other event?


Yes, but only under specific, controlled conditions.

The intended model is to draw *everything* in -drawRect:. If you arrange your code to do this, not only will life be easy, but you'll get the benefit of drawing optimisations that are built-in.

The way to do it is:


* on an event, make a note of the state change of your view.
* mark the relevant area as needing update using - needsDisplayInRect:
* in -drawRect:, use the state information to draw everything you need to draw in the appropriate state

So for example if you want to highlight something during mouse tracking, on mouse down set a flag, on mouse up, clear it. In drawRect, if the flag is set, draw the highlight, otherwise don't. In general you want to avoid trying to draw directly in response to the event itself.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >white screen windows at first (From: Bill Appleton <email@hidden>)
 >Re: white screen windows at first (From: "Paul Sanders" <email@hidden>)
 >Re: white screen windows at first (From: Bill Appleton <email@hidden>)
 >Re: white screen windows at first (From: Uli Kusterer <email@hidden>)
 >Re: white screen windows at first (From: Bill Appleton <email@hidden>)
 >Re: white screen windows at first (From: "Paul Sanders" <email@hidden>)
 >Re: white screen windows at first (From: vincent habchi <email@hidden>)
 >Re: white screen windows at first (From: Bill Appleton <email@hidden>)

  • Prev by Date: Re: UIView, UILabel, and sizeToFit
  • Next by Date: Re: advancementForGlyph problem
  • Previous by thread: Re: white screen windows at first
  • Next by thread: Re: white screen windows at first
  • Index(es):
    • Date
    • Thread