1

How to add tabbar below navigation bar using the Material's pod by CosmicMind

I was able to achieve this but it was touching the status bar like this

enter image description here

I want this to be below the status bar.

Ankit Kumar Gupta
  • 3,994
  • 4
  • 31
  • 54

2 Answers2

2

You can do with below code, add 20px StatusBar Height in Top(20)

fileprivate func prepareTabBar() {
    tabBar = TabBar()
    tabBar.delegate = self

    tabBar.dividerColor = Color.grey.lighten4
    tabBar.dividerAlignment = .bottom

    tabBar.lineColor = Color.indigo.base
    tabBar.lineAlignment = .bottom

    tabBar.backgroundColor = Color.grey.lighten3
    tabBar.buttons = buttons

    view.layout(tabBar).horizontally().top(20)
}

enter image description here

Bhavesh Dhaduk
  • 1,888
  • 15
  • 30
1

You can create custom class of Tabbar and change frame at top:

class CustomTabBarController: UITabBarController {

   @IBOutlet weak var myTabBarOutlet: UITabBar!

    override func viewDidLoad() {
        super.viewDidLoad()

        UIApplication.shared.statusBarFrame.size.height
        myTabBarOutlet.frame = CGRect(x: 0, y:  myTabBarOutlet.frame.size.height, width: myTabBarOutlet.frame.size.width, height: myTabBarOutlet.frame.size.height)
    }
Shabbir Ahmad
  • 615
  • 7
  • 17