Re: addSubview \ replaceSubview won't support embedded controls
Re: addSubview \ replaceSubview won't support embedded controls
- Subject: Re: addSubview \ replaceSubview won't support embedded controls
- From: Brian Webster <email@hidden>
- Date: Thu, 2 May 2002 16:16:17 -0500
On Thursday, May 2, 2002, at 03:35 PM, cocoa-dev-
email@hidden wrote:
Top of the view has a static text saying "This is a test"
Below that has an image view. I put a data browser on top of the image
view (the borders for image view make it look really nice) and tried
displaying that view. Everything displayed except the data browser
because it was on top of something.
I'm not exactly sure of the language you're using to describe
this. When you say "put the data browser on top of the image
view", are you doing this in code (i.e. calling addSubview: ta
add the browser as a subview of the image view) or in Interface
Builder (dragging the browser on top of the image view). If
you're doing this in IB, then it's not working because when you
drag the browser on top of the image view, it doesn't become a
subview of the image view, since the image view does not support
dragging subviews into it in IB. NSViews are not meant to be
overlapped and the front to back ordering of them is not
necessarily respected when drawing, so your browser might be
drawing behind the image view, even though it appears on top in
IB. If you add the browser in code, though, there's no reason
this shouldn't work.
That being said, there are two methods that are typically used
for swappable views:
1. Create an NSBox with no title and no border and set its
content view to swap views in and out. This used to be the best
way to do it until option 2 came around.
2. Create an NSTabView and click the "tabless" button in the
inspector. You can then create each of your views as a tab view
item of the tab view and switch between them by simply setting
the appropriate tab view item. Of course you could also dump
the pop-up menu altogether and just use a tabbed view, but this
might not be appropriate for your app, especially if there are
lots of choices that would make too many tabs be unwieldy.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.