1

I'm very new to iOS development, and I'm stuck in creating a grid view which looks like the following

gridview

Above picture is from Storyboard, when I run on iPhone 5s or lower device screen won't looks like the above. Please guide me to solve this riddle.

Any help will be highly appreciated.

Chethan Shetty
  • 1,972
  • 4
  • 25
  • 45
  • 1
    I think most developers agree autolayout is a mixed bag of help and hurt. It will take some experimentation to get used to it. Best advice is don't be afraid to blow away constraints. Second best advice is to discover that constraints can be turned into properties (option drag using assistant editor to View Controller). Having said that here's a previous post I made with a picture that might help you conceptualize rules for autolayout http://stackoverflow.com/a/25631764/1758337 – timothykc Oct 14 '14 at 16:16
  • @timothykc thanks for your valuable time, I'll definitely follow what you mentioned, if you can spend a little time for my pot I'll be very thankful, please guide me :) – Chethan Shetty Oct 14 '14 at 16:19

1 Answers1

1

This can be done by two tricks.

The first trick is to introduce two additional views not shown in your figure. The additional views will serve as parents.

enter image description here

The second trick is to take advantage of the add new constrains tool in the steps that follows.

In step one, we add and arrange the root view's three children. All children should have the same height.

enter image description here

In step 2, we add two children to the middle view. Both should have the same width

enter image description here

Finally, these two children must have the same height.

enter image description here

ragnarius
  • 5,642
  • 10
  • 47
  • 68