I am trying to see how i can add a UIView under my UITabBarController so i can add ads to my app, I cant seem to figure out any way to constrain my UIView to the bottom of the tab bar. Is this possible?
EDIT: By bottom of the tab bar i mean below the tab bar
Try this add see:

Follow these steps to achieve it:
UIViewController in root of your storyboardContainer View inside UIViewController
AdView below Container view
UITabbarController with Container view
I was able to create a UIView in my UITabBarController
lazy var bannerAd: UIView = {
    let view = UIView()
    view.translatesAutoresizingMaskIntoConstraints = false
    view.backgroundColor = .black
    return view
}()
And then pin it to the bottom like so:
  view.addSubview(bannerAd)
    bannerAd.heightAnchor.constraint(equalToConstant: 44).isActive = true
    bannerAd.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
    bannerAd.widthAnchor.constraint(equalTo: self.view.widthAnchor).isActive = true
then to move up the Tab Bar i did so like this:
override func viewWillLayoutSubviews() {
        if !didStyleTabBar {
            self.tabBar.invalidateIntrinsicContentSize()
            var tabFrame = self.tabBar.frame
            tabFrame.size.height = tabBarHeight
            tabFrame.origin.y = tabFrame.origin.y - 44
            self.tabBar.frame = tabFrame
            didStyleTabBar = true
        }
    }
                        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