ios swift development


NSLayoutConstraint-2.Align a custom view with flexible width-height


Hide/Show description

This video guides you how to layout constraint a custom View with flexible width and height. It is auto layout with top, down, left, right alignment. Main steps are: 1. Add layout constraint with centerView's top with view's top. Value is 40 pixels. Add layout constraint with centerView's bottom with view's bottom. Value is -40 pixels. 2. Add layout constraint with centerView's left with view's left. Value is 20 pixels. Add layout constraint with centerView's right with view's right. Value is -20 pixels. 3. Change background color of centerView to yellow, red,.. 4. Test result with both iPhone and iPad simulator, portrait and landscape rotations. SUBSCRIBE TO CHANNEL: https://www.youtube.com/c/NguyenDucHoang Twitter: https://twitter.com/NguyenD97601913 Facebook: https://www.facebook.com/nguyen.duc.hoang.bk