Mac OS X 应用程序的最小窗口大小
这里有两个问题。
第一个问题,在我的 Mac OS X 应用程序中,窗口已启用调整大小。我的窗口内容的窗口大小为 500x500。问题是用户可以调整它的大小,从而导致某些内容被切断。我需要做什么才能让用户只能调整到最小尺寸(在我的例子中为 500x500)?
第二个问题,当我关闭 Mac 应用程序(通过单击窗口顶部的红叉按钮)时,应用程序图标保留在底部的扩展坞中。当用户再次单击它时,它不会启动应用程序,除非用户完全退出应用程序并再次重新启动它。我需要什么设置才能让用户可以通过单击停靠图标来关闭并重新启动它?
谢谢
Two questions here.
First question, In my Mac OS X application the window has resizing enabled. My window contents are on a 500x500 window size. Problem is that user can resize it so some of the contents cutts off. What I need to do so user can only resize to a minimum size (In my case 500x500)?
Second question, When I close my Mac application (by clicking red cross button on window top) the app icon stays in the dock at the bottom. When user click on it again it does not fire up the application unless user quit the application all togeter and relaunches it again. What settings do I need so user can close and relaunch it by clicking dock icon?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 -[NSWindow setMinSize:] 以编程方式设置最小尺寸,但您也可以在 Interface Builder 中设置最小尺寸(查看带有尺寸的选项卡)。
要使应用程序在窗口关闭时退出,您需要将其添加到您的应用程序委托中:
Use -[NSWindow setMinSize:] to set the minimum size programmatically, but you can also set the minimum size inside Interface Builder (look at the tab with the sizes).
To make the application quit when the window is closed, you need to add this to your app delegate: