2014-12-02 166 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