将NSWindow大小保存在“调整大小"和“对用户关闭 [英] Save NSWindow Size on Resize & Close For User

查看:57
本文介绍了将NSWindow大小保存在“调整大小"和“对用户关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到OS X上的所有应用程序似乎都保存了您设置的大小.下次打开时,通常位置和大小都相同.

I've noticed that all applications on OS X seem to save the size you set it at. The next time you open it it's typically in the same position and size.

我正在制作一个应用程序,我注意到在调整大小之后,如果再次启动该应用程序,它的大小只是我在Xcode 4 IB中设置的大小,而不是我在启动时将其调整大小的大小.

I'm making an app and I've noticed that after resizing, if I launch the application again it's just the size of what I've set in Xcode 4's IB and not the size that I resized it to on launch.

每次更改窗口大小时,是否都必须手动保存?还是有一种更简单的方法可以通过IB做到这一点?(如果更改了任何内容,则我的窗口确实设置了最小尺寸.)

Do I have to manually save the window size each time its changed? Or is there an easier way to do this through IB? (My window does have a minimum size set if that changes anything.)

推荐答案

Apple使其易于使用.在界面构建器中,对于您的窗口,只需在 Autosave 字段中键入一个唯一名称,它将以该名称保存在全局默认用户名下.例如

Apple makes it easy. In interface builder, for your window, just type in a unique name in the Autosave field and it will save it under that name in the global user defaults. E.G.

这篇关于将NSWindow大小保存在“调整大小"和“对用户关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆