Cocoa predefined resize mouse cursor?

半腔热情 提交于 2019-12-04 08:31:10

I think you are particularly interested in these class methods (Preview.app dissasembly).

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

According to disassembly of AppKit these are private methods of NSCursor.

You can try it in your code e.g.

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

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

There are more undocumented cursors such as

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

and many many more

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!