i have a view controllers in a tab bar controller with constraints to bottom safe area, but one of them i must hide tab bar i use this self.tabBarController?.tabBar.isHidden = true this increase the safe area
But if i need to move to another i show back tab bar self.tabBarController?.tabBar.isHidden = false But safe area don't decrease by itself, making view contents behind tab bar
To make it clear i put a red view pinned to bottom safe area, next i go to view and hide tab bar

this is when it come back to this view and show tab bar again, safe area increased below tab bar, that's why red square are more below

It appears to be a bug in iOS. SafeArea doesn't change to account for tabBar, after hiding / showing it.
You can work around it by anchoring your view to superview and adjusting for tabBar manually. For example, if you want to anchor a tableView to a tabBar it would look like this
if let tabBar = tabBarController?.tabBar {
tabBar.isHidden = true
tableViewBottomConstraint.constant = tabBar.frame.height
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With