「マウスオーバー」リスナーを IKImageBrowserCell (NSView または NSCell ではない) に追加するにはどうすればよいですか? 単に NSObject から継承しますか?
質問する
293 次
1 に答える
0
IKImageBrowserCell
NSObject のサブクラスであるため、サブクラスでマウス イベント メソッドを使用することをお勧めしますIKImageBrowserView
。以下のように、それぞれのイベントの locationInWindow を使用して、マウスの下のセルを検出できます。
- (void)mouseEntered:(NSEvent *)theEvent {
NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
NSInteger itemIndex = [self indexOfItemAtPoint:point];
//Use this itemIndex to do manipulations on your item or cell.
}
授業中となりますNSResponder
。 IKmageBrowserView
は のサブクラスでNSView
あり、 は のサブクラスですNSResponder
。
IKImageBrowserView : NSView : NSResponder : NSObject
于 2013-03-22T16:54:07.577 に答える