Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Layering Elements in NSViews for NSToolbarItems?

Layering Elements in NSViews for NSToolbarItems?
Thread Tools
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Offline
Reply With Quote
Feb 9, 2004, 08:34 PM
 
I had tried before to add buttons on top of images and similar things in my NSViews intended for use in NSToolbarItems, and it wasn't working. Then the other day I got the idea to layer the image on top of the button and lo and behold it worked! (the layering worked backwards when actually running the application). But this has me worried now; is this just a bug that one day Apple will fix and suddenly I'll have to redo my nib file, or worse I'll need two nib files, one for before the OS update in question and one for after? Has anyone else ever even run into this issue?
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Feb 10, 2004, 03:13 AM
 
Though Interface Builder has Bring to Front / Send to Back commands, the Cocoa view architecture doesn't actually doesn't make any provision for layering, so there's no guarantee what order things will appear at runtime.

The only way to be sure about this sort of thing is to make the view that's on top be a subview of the view on the bottom. I think you still can't do this in IB (it has this hardcoded notion of what controls are "supposed" to be container views, but really any view can), but it's pretty easy to set it up in IB and then swizzle the containment at runtime. (This is how we do the popup-arrow trick in OmniWeb's back and forward toolbar buttons.)
Rick Roe
icons.cx | weblog
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:58 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2