Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to align 3 Views side by side with same width in auto layout by only using interfacebuilder?

I have a quick question according auto layout. Maybe I am missing something, but since two hours I am trying to align 3 views next to each other with same width. My goal is that each view is using 1/3 of the screens with. After autorotation all views should have each the same width, but all views next to each other should have a total width of the superview.

My idea looks like this:

enter image description here

Doing this programmatically is kind of easy. Is it possible to solve this task by only using interface builder?

like image 485
JackPearse Avatar asked Mar 16 '23 04:03

JackPearse


1 Answers

Yes just set it as the same size as parent view (then change it to 1:3 ratio) and set leading constraints to 0. You do this by ctrl dragging the view you want to it's super view. There you select the Equal Widths property.

Like this, but 1:3 ratio

enter image description here

like image 190
Stefan Salatic Avatar answered Apr 02 '23 11:04

Stefan Salatic