• 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: Layering NSViews -- why isn't this recommended?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Layering NSViews -- why isn't this recommended?


  • Subject: Re: Layering NSViews -- why isn't this recommended?
  • From: Andrew Platzer <email@hidden>
  • Date: Thu, 7 Jun 2001 11:00:34 -0700

On Wednesday, June 6, 2001, at 08:29 , Michael P. Rogers wrote:
I've been trying to create a pile of cards that are offset -- so each card is to the right and below the one beneath it (ala Eric's Solitaire, which I believe used to ship with the Mac at one time). My Cards are subclasses of NSImageView.
My plan is to
1) make a Card class (subclass of NSImageView)
2) place those Cards in a Window's contentView using a method in NSView that sounded promising, addSubview:positioned:relativeTo:.
It seems to work, but the documentation has this dire warning:

The main problem is the drawing code does not check for overlapping views.
If view_2 comes after view_1 then it will appear to be over view_1 when the window is redrawn but if an action forces only view_1 to redraw, view_2 won't be redrawn and the layering will appear to change. Also, finding which view a mouse click is in may return the wrong view.

For something like a card game, just have a single view that draws all the images. It's faster and smaller.

Andrew
__________________________________________________________________
A n d r e w P l a t z e r
A p p l i c a t i o n F r a m e w o r k s
A p p l e


References: 
 >Layering NSViews -- why isn't this recommended? (From: "Michael P. Rogers" <email@hidden>)

  • Prev by Date: Re: Summary of drawing routines?
  • Next by Date: Re: "public header"
  • Previous by thread: Re: Layering NSViews -- why isn't this recommended?
  • Next by thread: Re: Layering NSViews -- why isn't this recommended?
  • Index(es):
    • Date
    • Thread