Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do match_parent in iOS

Tags:

android

ios

I am used to having an Android background where I do:

android_layout_width="match_parent" or android_layout_height="match_parent"

How is this behavior done on iOS, using xib?

like image 414
Zar E Ahmer Avatar asked Nov 13 '14 07:11

Zar E Ahmer


2 Answers

1) Set frame of child view matching parent's view bounds.
2) Enable autoresizing mask like in screenshot.

enter image description here

like image 176
l0gg3r Avatar answered Nov 18 '22 01:11

l0gg3r


You have to create two constraints from the child to it's parent view:

  • equal width
  • equal height

UIB define constraint

It's also possible to define a margin (select the created constraint within the size inspector) enter image description here

like image 33
Eike Avatar answered Nov 18 '22 02:11

Eike