2014-12-02 68 views
3

是否使用預覽調整鼠標光標(例如,在調整形狀大小時)系統光標?Cocoa預定義調整鼠標光標?

enter image description here

它直接是不能作爲NSCursor的方法,但隨後它看起來並不像有遊標在預覽應用程序的包無論是..

是否有更多的系統指針的私人資源除了NSCursor類定義的方法外。

回答

9

我認爲你對這些類方法(Preview.app dissasembly)特別感興趣。

+[NSCursor resizeAngle45Cursor]; which calls +[NSCursor _windowResizeNorthEastSouthWestCursor]; 
+[NSCursor resizeAngle135Cursor]; which calls +[NSCursor _windowResizeNorthWestSouthEastCursor]; 

根據AppKit的反彙編,這些是NSCursor的私有方法。

您可以在您的代碼中嘗試

(void)mouseDown:(NSEvent *)theEvent 
{ 
    [[self window] disableCursorRects]; 

    id cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthEastSouthWestCursor)]; 
    [cursor push]; 
} 

還有更多的無證遊標如

+[NSCursor _helpCursor]; 
+[NSCursor _zoomInCursor]; 
+[NSCursor _zoomOutCursor]; 

和許多許多 enter image description here

+1

上述大部分光標記錄的;在http://developer.apple.com搜索它們(不帶前導下劃線)。他們大多數在。 – geowar 2016-03-31 15:12:06

+1

geowar 2016-03-31 15:21:58

+0

你是對的,但問題是關於旋轉調整大小遊標,我無法在文檔。更新了文檔鏈接。 https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCursor_Class/#//apple_ref/doc/constant_group/AppKit_Versions_for_NSCursor_Bug_Fixes – 2016-04-14 05:29:47