I have several apps where I successfully implemented Safe Area Margins, but this app uses a Tab Bar Controller and it ignores the safe areas. I am using Xcode 16.2, and Storyboards. The "Use Safe Area Layout Guides" is checked for every scene, yet none are using the safe area. Any clues?
Tab Bar Controller Not Using Safe Area
On what View did you apply the constraints ?
Could you:
- a screenshot explaining what you get and what you'd expect
- a screenshot of the Size Inspector in which constraints are defined
The attached image shows the safe area highlighted with the view "Playview". However, when I run the code in debugger, I can see that both CGRect frame1 = self.view.frame; CGRect frame = self.view.safeAreaLayoutGuide.layoutFrame;
give the same frame. This is not the case with a different tab view that has subviews added programmatically as opposed to this one that has them in IB.
I believe I found the issue - the safeAreaLayoutGuide isn't the correct value until viewDidLayoutSubviews is called.