I have an application based on a custom tabBar controller
, and now, since we have a secure area layout, I want to change my application to fully use the iPhone X screen.
So, I want to fix the tabBar problem, which currently does not address the safe area.
I went through most of the solutions that people post, but they are mostly for UIViewController
.
My current tabBar is as follows

I use RDVTabBar
for this, and this tab bar is an instance UIView
, and I do not use a storyboard or xib, everything is done programmatically.
Current code to fix the problem
if (@available(iOS 11.0, *)) {
UILayoutGuide *safe = self.view.safeAreaLayoutGuide;
self.tabBar.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[[safe.trailingAnchor constraintEqualToAnchor:self.tabBar.trailingAnchor],
[self.tabBar.leadingAnchor constraintEqualToAnchor:safe.leadingAnchor],
[safe.bottomAnchor constraintEqualToAnchor:self.tabBar.bottomAnchor]]];
[self.tabBar addConstraint:[NSLayoutConstraint constraintWithItem:self.tabBar
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute: NSLayoutAttributeNotAnAttribute
multiplier:1
constant:45]];
}
But that doesn’t change anything
, ,
CGRect frame = self.tabBar.frame;
frame.origin.y = frame.origin.y - 34;
frame.size.height = frame.size.height + 34;
self.tabBar.frame = frame;
, , ; .
, , tabBar?