Re: highlight a nsview on click-drag?
Re: highlight a nsview on click-drag?
- Subject: Re: highlight a nsview on click-drag?
- From: "Patrick J. Collins" <email@hidden>
- Date: Sun, 15 Mar 2015 01:22:31 -0700 (PDT)
> A fairly simple way to implement a selection rectangle is to use
> CALayer, but that only gives you the visual aspect. What does it
> select? Answer that question first and that will tend to lead you to
> the appropriate way to implement it.
This NSView is of an audio waveform. I currently have my drawRect:
method draw the lines of my waveform, but as soon as I added a timer
loop to move my playhead over the waveform as it plays, I found that
this was not the right approach, as everytime the playhead moved, the
parent (waveform view) would have to redraw itself, and this result in
the playhead moving in an extremely choppy fashion.
My next approach was to save my drawn waveform to an NSImage and use
that as a background for my view... If you have a better suggestion for
how I could handle this, I'd love to hear it.
And to answer your question, the selection would be selecting frames of
audio, so that when it is played, the playhead starts there and ends at
the end of the rectangle.
Patrick J. Collins
http://collinatorstudios.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden