Re: Lining up NSViews in NSScrollView
Re: Lining up NSViews in NSScrollView
- Subject: Re: Lining up NSViews in NSScrollView
- From: Ricky Sharp <email@hidden>
- Date: Sun, 20 Feb 2005 09:50:51 -0600
On Feb 20, 2005, at 2:45 AM, daniel wrote:
You can't "put views on top of other views." You can only put views
inside other views. There must be a hierarchical relationship between
all views in your window.
This isn't true. You can overlap views, but must be a bit more
careful. For example, you shouldn't instruct the containing window to
use optimized drawing (see useOptimizedDrawing:) when views overlap.
You might accomplish what you are trying to do by creating a custom
subclass of NSTextView that is capable of drawing embellishments on
top of whatever the base class draws. For any views you have in mind
that have corresponding cells, you could use cells to draw their
representations on top of the text view. If they don't have cells,
you could render the views into an NSImage and then draw them on top
of the view.
If your requirements are much more complicated than that, then the
answer might involve secondary, borderless windows that are positioned
over your primary window, set up with an appropriate scrolling view
that is scrolled in sync with the main window. If you are envisioning
a limitless number of "layers" then perhaps this is your answer.
Either of these approaches should work well. I'd make a guess that the
overlay window may ultimately provide for better performance since if
there's no change to the content of the underlying window, it can be
redrawn very quickly.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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