好了,現在的問題是:
我有一個NSTextView
,我添加使用我的自定義NSButton
:當光標懸停在NSTextView中的NSButton時,如何強制光標變成「arrowCursor」?
[_textView addSubview:button];
然後,我NSButton
子裏面,我有(與NSTrackingArea
東西一起):
- (void)mouseEntered:(NSEvent *)event{
[[NSCursor arrowCursor] set];
}
- (void)mouseExited:(NSEvent *)theEvent{
[[NSCursor arrowCursor] set];
}
- (void)mouseDown:(NSEvent *)theEvent{
[[NSCursor arrowCursor] set];
}
- (void)mouseUp:(NSEvent *)theEvent{
[[NSCursor arrowCursor] set];
}
但是當我將它懸停時,光標保持不變IBeamCursor
(因爲它是NSTextView
)。只有當我按下按鈕時,光標纔會更新。然後,當我移動鼠標時,仍然在按鈕內,光標回到IBeamCursor
。
有關如何做到這一點的任何想法?謝謝!
您是否嘗試過實施'cursorUpdate:',如[規定」管理遊標更新事件「](http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/TrackingAreaObjects/TrackingAreaObjects.html#//apple_ref/doc/uid/10000060i-CH8-SW10) ? – 2013-04-29 20:32:17
是的,但結果是相同的 – 2013-04-29 21:14:37