I have an NSView that is drawing a collection of irregularly shaped (and overlapping) application managed objects: that obviously can't be described by efficiently using non overlapping rectangles.
I want to change the cursor when it it over one of these objects.
The usual method seems to be to set up tracking rects in response to -(void)resetCursorRects
, each associated with a different cursor, but I can't apply that to this situation.
I only know which object is top most under the cursor when processing -(void)mouseMoved:(NSEvent *)theEvent
messages... so I need to change the cursor then.
Is this appropriate? When is NSView going to try and set the cursor to the usual arrow? I don't want to end up with a flickering c开发者_高级运维ursor because NSView is setting it to default on a different message.
Consider using tracking areas: Using Tracking-Area Objects. Particularly, NSTrackingCursorUpdate. This way, you can respond specifically to the individual types of tracking events. I think this helps avoid the situation you described.
精彩评论