This article continues from the previous article. Earlier we saw how we can make iOS Apps without using the storyboard file. In this article we will explore how to implement Autolayout programmatically. We will continue from the previous article.
The code that I will be showing in the article will not be covering all the possible cases. The point of this article is to give you an idea on how to implement the different Autolayout solutions. Feel free to play around with the code to cover all the cases & situations.
We have 3 options when it comes to applying constraints programmatically:
- Layout Anchors
- NSLayoutConstraints class
- Visual Format Language (VFL)
Handling Size Classes in code
Handling Size classes in code is fairly easy. It is a simple question of overriding the correct function. We will look at this in greater detail when we cover the topic later in the article.
|Implementing Layout Anchors||3|
|Implementing Visual Format Language||5|
|Summary & Video||7|
This article has been written using Xcode 10.3.