--When I used status Bar height
on iPhone12 mini to calculate the layout, the result was not as expected and the layout was misaligned.
Xcode 12.3
Build version 12C33
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
--I actually made a sample app and tried to display the values obtained by the simulator.
iPhone12
iPhone12 mini
iPhoneSE 2nd
--It turned out that there is a difference between safe Area and status Bar height on iPhone12 mini. --Verification code t-osawa-009/StatusBarTest
--Changed to use safeArea value for layout calculation
let height = navigationController?.view.safeAreaInsets.top ??
let height = view.safeAreaInsets.top
--Not statusBar height == safeAreaInsets.top
.
――In the future, we recommend that you create a layout based on the safe Area.
https://useyourloaf.com/blog/iphone-12-screen-sizes https://developer.apple.com/forums/thread/662466
Recommended Posts