我正在为我的项目开发NSTextFieldCell的子类。
在某些情况下,此子类在其视图上绘制了NSButtonCell,其中包含:
-(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{
if(self.isPresent){
[_button.cell drawWithFrame:cellFrame inView:controlView];
}
....
}
我正在实施hitTest
- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)frame ofView:(NSView *)controlView {
NSLog(@"hitTest !");
.............
hitType |= NSCellHitTrackableArea;
return hitType;
}
但我的问题是什么时候hitTest满足hitTestForEvent:被调用
对于相同的事件类型LeftMouseDown,每次两次,这很奇怪。结果我
得到意想不到的结果。我只想要hitTestForEvent:只能被调用一次,用于
LeftMouseDown活动。感谢任何帮助。