简体   繁体   English

仅从左下角调整NSWindow的大小?

[英]Resize NSWindow from bottom left corner only?

I am writing an application that sits in the OS X menu bar and when you press its icon a little NSPanel opens up. 我正在写一个位于OS X菜单栏中的应用程序,当您按其图标时,会打开一个小小的NSPanel。 I would like the user to be able to resize it, but only by dragging the bottom left corner. 我希望用户能够调整它的大小,但是只能拖动左下角。 I want to prevent them from being able to drag the top edge down and "unstick" the window from the menu bar. 我想阻止他们将顶部边缘向下拖动,并从菜单栏中“取消粘帖”窗口。

Just override touchesBegan mouseDown: and pass on the drag only if it is in the designated corner, discarding other touches. 只需覆盖 touchesBegan mouseDown:并仅在其位于指定的角落时才传递拖动,并丢弃其他触摸。

See Cocoa Event Handling Guide 请参阅可可事件处理指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM