任何布局/几何管理Cocoa? [英] Any layout/geometry management for Cocoa?

查看:118
本文介绍了任何布局/几何管理Cocoa?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我创建WinForms / Qt / Gtk应用程序,我使用所谓的布局管理器(或几何管理器)自动布局我的UI根据文本内部的小部件和我的指令。例如,如果我布局一个窗口大编辑字段和下面的2个按钮对齐右边我写下面的代码创建一个垂直布局管理器的窗口添加编辑窗口小部件作为第一项和水平布局管理器作为第二项水平布局管理器添加分隔符作为第一项,按钮作为第二和按钮作为第三。我的窗口将根据按钮标签和编辑字段大小自动调整大小。此外,如果我调整我的窗口的所有项目将自动调整大小。

If i create WinForms / Qt / Gtk application i use so called "layout managers" (or "geometry managers") to automatically layout my UI according to text inside widgets and my instructions. For example, if i layout a window with big edit field and 2 buttons below it aligned right i write following code "Create a window with vertical layout manager. Add edit widget as first item and horizontal layout manager as second item. For horizontal layout manager add spacer as first item, button as second and button as third". My window will be automatically resized according to button labels and edit field size. Also, if i resize my window all items will be resized automatically.

这是OSX的布局管理器吗?我发现NSView可以添加到层次结构,但我找不到任何方法来指示父NSView像安排子NSViews垂直。

Is it something like layout managers for OSX? I have found that NSView can be added into hierarchy, but i can't find any ways to instruct parent NSView something like "arrange child NSViews vertically".

推荐答案

您应该阅读关于 Cocoa Auto Layout ,在OS X 10.7中新增。

You should read about Cocoa Auto Layout, new in OS X 10.7.

这篇关于任何布局/几何管理Cocoa?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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