4

私はNSCell自分のプロジェクトのサブクラスに取り組んでいます。

このサブクラスは、状況によってはNSButtonCell、ビューに次のように描画されます:

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {

... 
    if (self.mode == PMVersatileCellButton) {
        [_button drawWithFrame:cellFrame inView:controlView];
inView:controlView];
    } else {

...

    }

    [super drawInteriorWithFrame:cellFrame inView:controlView];
}

問題ありません。図面について、問題はボタンをクリックして応答します!

私はこれをやろうとしています:

- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)frame ofView:(NSView *)controlView {

    NSLog(@"hitTest !");

    return [super hitTestForEvent:event inRect:frame ofView:controlView];

}

と :

+ (BOOL)prefersTrackingUntilMouseUp {
    return YES;
}

- (BOOL)startTrackingAt:(NSPoint) inView:(NSView *)

- (BOOL)trackMouse:(NSEvent *) inRect:(NSRect) ofView:(NSView *) untilMouseUp:(BOOL)

- (BOOL)continueTracking:(NSPoint) at:(NSPoint) inView:(NSView *)

- (void)stopTracking:(NSPoint) at:(NSPoint) inView:(NSView *) mouseIsUp:(BOOL)

しかし、hitTest などは決して呼び出されません...

呼び出されるだけ+ (BOOL)prefersTrackingUntilMouseUpで、あまり役に立ちません...

何か案が ?^^

4

0 に答える 0