在 OSX 上单击菜单项时,该项目会在菜单关闭前闪烁一次(on-off-on-close)。
我在问自己如何模仿这种行为?(我已经使用 NSCollectionView 重新实现了一个菜单,选择和单击项目都可以)
我试过 2 认为没有用:
mouseOver = false;
[self drawRect:self.bounds];
mouseOver = true;
[self drawRect:self.bounds];
[[self window] performSelector:@selector(orderOut:) withObject:nil afterDelay:0.1];
和
mouseOver = false;
[self setNeedsDisplayInRect:self.bounds];
[self needsDisplay];
mouseOver = true;
[self setNeedsDisplayInRect:self.bounds];
[self needsDisplay];
[[self window] performSelector:@selector(orderOut:) withObject:nil afterDelay:0.1];