When I launched my app while the device is rotated, safeAreaInsets are 0. The problem is, the view overlaps with the status bar. (ie. wifi, battery icon)
Steps to reproduce:
- Created a simple app with a UIViewController.
- Set the ViewController to work as portrait (though the device is rotated)
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
}
print(view.safeAreaInsets)
on viewDidAppear prints UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0)
Confirmed safeAreaInsets doesn't get changed afterwards by adding below.
override public func viewSafeAreaInsetsDidChange() {
super.viewSafeAreaInsetsDidChange()
print("SafeAreaInsetsDidChange")
}
This was fine in iOS15. Does anyone have any idea why?