Recently the adaptation of the iphone x, found some rules, the overall adaptation is very simple
The status bar at the top of the iphone X is 44px from the top of the security zone, and the other iphone is 20px,
The IPhone x security Zone is 34px from the bottom height
Added safe area to Xcode9
Let's get to the bottom.
Safearealayoutguide
First, let's see what Safearealayoutguide is.
Looks complicated, in fact very simple, I summed up a few points:
- It is a read-only property of UIView, which means that all UIView objects have and are created by the system to help us
- It inherits Uilayoutguide, and layoutframe means it can represent an area.
- The area it represents avoids all of the parent view, such as the navigation bar, Tabbar, or other potentially blocking your UIView object display, meaning that your view object can be laid out relative to the safelayoutguide of another view without worrying about her being blocked by weird things.
- For the safearealayoutguide of the controller's view, his area also avoids statusbar or other things that might block the view display, and we can even use the Additionalsafeareainsets property of the controller, To specify additional inset
- If the view is entirely within the security area of the parent view, or if the view is not on the viewing level or on the screen, then the Safearealayoutguide area of the view is actually as large as the view itself
Safearealayoutguide is a relatively abstract concept, for the sake of understanding, we can think of safearealayoutguide as a "view", this "view" system automatically helps us adjust its bounds, Let it not be blocked by a variety of strange things, including the fringe area of the iphone x and the bottom of a bar area, you can think of this "view" will be able to fully display all the content.
The following green section is the Safearealayoutguide area of the current controller view
iphone x vertical Screen safearealayoutguide bounds
IPhone x Horizontal screen safearealayoutguide bounds
iOS development-use safe area to match iphone X