我需要找出鼠标位置是否在NSView的矩形内。
我会使用NSPointInRect(point, rect),但我需要将矩形坐标转换为屏幕坐标,并且我不确定如何转换。任何帮助都将不胜感激!
发布于 2012-10-12 21:47:40
一些使用鼠标的代码:inRect:(推荐的方式;这解释了翻转的坐标)
CGPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
CGRect rect = [self bounds];
if ([self mouse:point inRect:rect]) {
}https://stackoverflow.com/questions/4630509
复制相似问题