调整 NSView 框架大小时锁定位置

发布于 2024-10-07 14:35:12 字数 101 浏览 1 评论 0原文

当我重新调整自定义 NSView 框架的大小时,它的位置最终会发生变化。基本上我希望它将它的位置锁定在左上角,这样当我更改宽度或高度时,它就会向右或向下扩展。有点难以解释,但想想文本对齐。

When I re-size my custom NSView's frame its position ends up changing. Basically I want it to lock it's position at the top left so when I change the width or height it expands right or down. Kinda hard to explain but think about like text alignment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别理我 2024-10-14 14:35:12

听起来您想要一个翻转的坐标系,请参阅 转换坐标系部分。

当视图的内容自然地起源于视图的顶部并向下流动时,翻转坐标系非常有用。例如,当新文本出现时,将文本向上滚动并移出屏幕的视图最好使用翻转坐标系来实现。

It sounds like you want a flipped coordinate system, see the second example in the Transforming the Coordinate System section.

A flipped coordinate system is useful when the contents of a view naturally originate at the top of a view, and flow downwards. For example, a view that scrolls text up and off the screen as new text appears would be best implemented using a flipped coordinate system.

再可℃爱ぅ一点好了 2024-10-14 14:35:12

看起来,您想要为每个子视图设置 SubViesResizingMask 属性......

It looks like, you want to setSubViesResizingMask, property for each subviews....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文