Reputation: 1631
Like the title says, there is an unexpected behavior that safe area constrained views get magnified on iOS when you try to navigate between UIViewControllers while toggling status bar hidden/unhidden.
A reproducible project can be found here.
I wonder if this is a bug in iOS. Hope someone can explain why the issue happens and how can we fix it.
Update:
For "get magnified" part above:
The issue only happens at a glance, 2-3 times out of 5, during the UIViewController's navigation so you may have to pay much attention so as to notice it.
The magnified parts are: green background and two white boxes.
Note that the views keep the same size before-and-after the navigation.
Also, in the project, you might want to tap 'Button' and 'Close' button continuously so that it switches very quickly, to easily get issue noticed.
Upvotes: 0
Views: 80
Reputation: 15639
Problem:
Your code for hiding status bar & changing orientation causing flickering. Actually this works in background thread & you press Button and Close buttons so quickly that you feel it. OS is under transition which will effect your height of view.
override var prefersStatusBarHidden: Bool {
return true
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return [ .landscape ]
}
Solution:
Upvotes: 0