cadstudy

在Mac系统中处理View的鼠标进入,退出以及移动事件时,需要把捕获的区域设置为view的bounds 不能设置为frame

1 self.trackingArea = [[[NSTrackingArea alloc] initWithRect:self.bounds options:NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow owner:self userInfo:nil] autorelease];
2 [self addTrackingArea:self.trackingArea];

如果上面代码的中矩形区域参数为self.frame 则会导致导致捕获鼠标的区域不准确。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-02-08
  • 2021-12-26
  • 2022-02-08
猜你喜欢
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2021-04-27
相关资源
相似解决方案