I wanted to get the height of the Safe Area, so I looked it up.
python
//Safe Area at the top
let safeAreaTop = self.view.safeAreaInsets.top
print(safeAreaTop)
//Safe Area at the bottom
let safeAreaBottom = self.view.safeAreaInsets.bottom
print(safeAreaBottom)
At the time of viewDidLoad
, the value of SafeArea could not be acquired, so it seems better to acquire it at viewWillLayoutSubviews
.
Recommended Posts