Chethan Shetty
Chethan Shetty

Reputation: 2070

Auto layout to create grid view in iOS8 Xcode 6

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.

Upvotes: 1

Views: 1215

Answers (1)

ragnarius
ragnarius

Reputation: 5813

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

Upvotes: 1

Related Questions