Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any layout/geometry management for Cocoa?

Tags:

cocoa

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.

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".

like image 296
grigoryvp Avatar asked Dec 03 '25 18:12

grigoryvp


1 Answers

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

like image 61
Ole Begemann Avatar answered Dec 06 '25 14:12

Ole Begemann