Re: mouse entered/exited in nscollectionviewitem's view
Re: mouse entered/exited in nscollectionviewitem's view
- Subject: Re: mouse entered/exited in nscollectionviewitem's view
- From: Keith Duncan <email@hidden>
- Date: Fri, 24 Jul 2009 14:23:56 +0100
the setup code only gets called once and then none of the actually
displayed views in the collection handle any of my intended mouse
tracking.
That's probably because your subclass of NSCollectionViewItem isn't
getting created for each item. You can override -copyWithZone: to
confirm this and fix it if need be.
It's also prudent to ask for the mouse moved events to be sent too.
Could anyone please point me into the right direction where to go on
from here?
Any help is appreciated.
Yes, you'll also run into a problem when the user uses the scroll
wheel to move around the collection view. The fix for this one is
slightly more in depth.
Your view under the mouse will first be send -scrollWheel: and it will
work it's way up the responder chain to the scroll view from there. I
inserted my NSCollectionViewItem subclass into the responder chain
between the item view and it's superview so that the controller was
sent -scrollWheel: before the scroll view.
In that method I tracked the position of the mouse converting from
window coordinates to collection view coordinates and determined which
view the mouse was hovering over. Once you've done that it's a simple
matter of posting a notification internal to the collection view item
subclass to coordinate the hovering state between controllers so that
only one is showing the hovering state at a given time.
Keith
_______________________________________________
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