# Auto Layout Tutorial in iOS 9 Part 2: Constraints

**URL:** <https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419>\
**Category:** 🎓 Courses & Articles\
**Created:** [March 4, 2016, 10:42am UTC](https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419 "2016-03-04T10:42:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpj823](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bpj823/32/32857_2.png) [@bpj823](https://forums.kodeco.com/u/bpj823)\
**Post date:** [March 4, 2016, 10:42am UTC](https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419/1 "2016-03-04T10:42:39Z")

</div>

Learn the basics of auto layout including resolving layout conflicts in part 2 of this auto layout tutorial, fully up-to-date with iOS 9.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/1563-auto-layout-tutorial-in-ios-9-part-2-constraints](https://www.raywenderlich.com/1563-auto-layout-tutorial-in-ios-9-part-2-constraints)

---

<div class="post-metadata">

**Author:** ![xueyu](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@xueyu](https://forums.kodeco.com/u/xueyu)\
**Post date:** [May 13, 2016, 10:50pm UTC](https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419/2 "2016-05-13T22:50:27Z")

</div>

Actually for the Gallery example, one can still use Size classes, because we can just build views and make the width half the superview’s width, and let the 2\* height = superview.height - stausbarheight, we can add these constraints, I tried, one can make the Gallery work on different size of iPads/iPhones.

---

<div class="post-metadata">

**Author:** ![rvaessen](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rvaessen/32/66784_2.png) [@rvaessen](https://forums.kodeco.com/u/rvaessen)\
**Post date:** [August 9, 2016, 9:20pm UTC](https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419/3 "2016-08-09T21:20:35Z")

</div>

Brad, Thank you very much for the most excellent tutorial! I have gone from utterly confused to I can deal with Auto Layouts now.

---

<div class="post-metadata">

**Author:** ![kumaresan](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kumaresan/32/81494_2.png) [@kumaresan](https://forums.kodeco.com/u/kumaresan)\
**Post date:** [August 20, 2016, 4:08pm UTC](https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419/4 "2016-08-20T16:08:25Z")

</div>

can you suggest common layout for both iPhone & iPad.

---

<div class="post-metadata">

**Author:** ![ilmaros](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ilmaros/32/81494_2.png) [@ilmaros](https://forums.kodeco.com/u/ilmaros)\
**Post date:** [November 28, 2016, 8:15pm UTC](https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419/5 "2016-11-28T20:15:30Z")

</div>

Very good tutorial : )  
I liked how you went from one problem + solution (easiest one) to another pair of problem + solution (to complicated one)!

---

<div class="post-metadata">

**Author:** ![cthree87](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/cthree87/32/52385_2.png) [@cthree87](https://forums.kodeco.com/u/cthree87)\
**Post date:** [December 22, 2016, 8:26pm UTC](https://forums.kodeco.com/t/auto-layout-tutorial-in-ios-9-part-2-constraints/6419/6 "2016-12-22T20:26:15Z")

</div>

Is there a tutorial on how to apply auto layout constraints in code? I need to set constraints for a WKWebView which I can’t do in Interface Builder.
