• 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: Object Layering is Changing When Calling -addSubview:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object Layering is Changing When Calling -addSubview:


  • Subject: Re: Object Layering is Changing When Calling -addSubview:
  • From: Matt Neuburg <email@hidden>
  • Date: Sat, 02 Sep 2006 11:20:33 -0700
  • Thread-topic: Object Layering is Changing When Calling -addSubview:

On Sat, 2 Sep 2006 18:14:51 +0200, Dave Batton
<email@hidden> said:
>
>I wanted a gradient behind some buttons. So I placed an NSImageView
>in my window to display a 1 pixel wide tiff scaled to fit across the
>window. Then I placed some NSButtons on top of it. That worked great.

Nevertheless, you shouldn't have done it.

>Now my design has become a little more complex, so now in my window I
>have a Custom NSView there, and I've moved the previous contents to a
>separate view. At runtime I move the separate view into the window
>using -addSubview:. That works great too, _except_  that the NSView
>is now drawn in front of the buttons. I can tell because if I move
>the background object a little I can clearly see the active buttons
>behind it. I've double checked the layering of the objects in the
>view, and the buttons are in front of the NSImageView. And the
>NSImageView is inactive, and the buttons are active.
>
>How can I force the buttons to be drawn on top of the NSImageView
>object?

There is no such thing as "object layering". Subviews of the same view must
not overlap. If you want a button to "appear in front" of your custom
NSView, make the button a subview of the custom NSView. See the docs:

<http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/W
orkingWithAViewHierarchy/chapter_4_section_5.html>

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

  • Follow-Ups:
    • Re: Object Layering is Changing When Calling -addSubview:
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: NSSlider did finish sliding
  • Next by Date: Re: Re: Re: NSSlider did finish sliding
  • Previous by thread: Re: Object Layering is Changing When Calling -addSubview:
  • Next by thread: Re: Object Layering is Changing When Calling -addSubview:
  • Index(es):
    • Date
    • Thread