私が考えることができる唯一の解決策は、NSCell 内で手動のヒット テストとマウス トラッキングを使用することです。最も難しい部分 (私には答えがありません) は、リンク テキストの四角形を決定する方法です。うまくいけば、誰かがそれに答えることができますか?
URL テキストの rect がわかれば、hitTestForEvent を実装してクリック アクションを実装できます。このようなことをすると思います。
// If the event is a mouse down event and the point is inside the rect trigger the url
- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)frame ofView:(NSView *)controlView {
NSPoint point = [controlView convertPoint:[event locationInWindow] fromView:nil];
// Check that the point is over the url region
if (NSPointInRect(point, urlFrame)) {
// If event is mousedown activate url
// Insert code here to activate url
return NSCellHitTrackableArea;
} else {
return [super hitTestForEvent:event inRect:frame ofView:controlView];
}
}