I can't find a way to create a 'square' constraint, meaning 'width equals height' in Interface Builder. I guess it's possible to add such constraint programmatically. Is there something I can do in IB? Maybe I just don't see it? It seems trivial, yet I can't find it.
Ios – “Width equals height” constraint in Interface Builder
autolayoutinterface-builderiosnslayoutconstraint
Related Topic
- Sql value which isn’t for the needed date but first available
- Ios – UIScrollView Scrollable Content Size Ambiguity
- Ios – WKWebView in Interface Builder
- C++ – Is it possible to generate types with all combinations of template arguments
- Ios – Emulating aspect-fit behaviour using AutoLayout constraints in Xcode 6
Best Answer
Update Xcode 5.1b5
Ctrl+click and drag from a view and release while the pointer is over the view. Select "Aspect Ratio". It will create a constraint where the first and second item is the view.
Before Xcode 5.1
You can't because the width/height editor lacks the fields to relate to another property or set the ratio:
Therefore, you can't express the following code in Interface Builder: