Chameleon
Chameleon copied to clipboard
Scrolling UIScrollView should update mouse entered/exited events for table view cells
so from what I can see -
UIKitView : NSView NSTrackingArea *_trackingArea;
this has a tracking area for entire window block configured by -> _trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds options:NSTrackingCursorUpdate | NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingActiveInKeyWindow | NSTrackingMouseEnteredAndExited owner:self userInfo:nil]; [self addTrackingArea:_trackingArea];
which gets a callback when mouse goes on and off the screen
- (void)mouseEntered:(NSEvent *)theEvent { NSLog(@"mouseEntered"); [self mouseMoved:theEvent]; }
- (void)mouseExited:(NSEvent *)theEvent { NSLog(@"mouseExited"); }
UIView doesn't have a addTrackingArea:_trackingArea - method..... so an attempt to port this - is probably futile as used need to replicate the nsviews and the uitableview has a queue of cells and the problem would grow trying to duplicate the uiview stack to nsviews....
however - we do have point inside method in uikit. and if we can track the current mouse position - along with pointInside - we may be able fudge it. I'm going to take a look.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event;
ok - I got it.
In your subclass of uitableviewcell - override these methods for correct callbacks.
- (void)mouseEntered:(UIView *)view withEvent:(UIEvent *)event;
- (void)mouseMoved:(UITouch *)touch withEvent:(UIEvent *)event;
- (void)mouseExited:(UIView *)view withEvent:(UIEvent *)event;