0

「マウスオーバー」リスナーを IKImageBrowserCell (NSView または NSCell ではない) に追加するにはどうすればよいですか? 単に NSObject から継承しますか?

4

1 に答える 1

0

IKImageBrowserCellNSObject のサブクラスであるため、サブクラスでマウス イベント メソッドを使用することをお勧めします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.
}

授業中となりますNSResponderIKmageBrowserViewは のサブクラスでNSViewあり、 は のサブクラスですNSResponder

IKImageBrowserView : NSView : NSResponder : NSObject

于 2013-03-22T16:54:07.577 に答える