Make the divider of an NSSplitView undraggable and don't show the dragging cursor

前端 未结 2 802
失恋的感觉
失恋的感觉 2021-02-01 22:11

I have an NSSplitView (NO UISplitView(Controller)!!) with three subviews. Now, for the last divider (index 1), I want the divider to not show the d

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 22:55

    Try using splitView:constrainMaxCoordinate:ofSubviewAt: and splitView:constrainMinCoordinate:ofSubviewAt: instead of splitView:constrainSplitPosition:ofSubviewAt:.

    The former two methods are called once as the user drags the mouse and they give enough information for NSSplitView to know how to change the cursor during the drag.

    The latter is called repeatedly as the user drags the splitter, so NSSplitView doesn't have enough information to know that you're returning a constant value each time and therefore can't change the cursor.

提交回复
热议问题