24 Ocak 2015 Cumartesi

Basic AutoLayout Example in iOS - 1

Let's make a basic autolayout example.

Firstly add a blue view the upper left corner.

Add the constraints for the blue view

height = 100
width = 100


Update Frames for blue view






Seconly, add a purple view the center

Add the constraints for the purple view

height = 200
width = 200


In order to show a view on the center, we must add alignment constraints:
1. Horizontal center in Container
2. Vertical center in Container


Update Frames for purple view


Finally add a orange view the upper left corner.

Add the constraints for the orange view

height = 100
width = 100

Update Frames for orange view

Let's control storyboard preview for iPhone sizes.




Result for iPhone 6








You can download from  https://github.com/ozlemakalin/BasicAutoLayoutExample





Hiç yorum yok:

Yorum Gönder