2017-06-21 61 views
1

如何添加以下使用材料的吊艙由CosmicMind導航欄的TabBar添加下面狀態欄標籤欄使用材料的iOS

我能做到這一點,但它觸及這樣

enter image description here

狀態欄

我希望這是低於狀態欄。

回答

1

您可以在上面創建自定義類的TabBar和變化框架:

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) 
    } 
2

你可以用下面的代碼做,在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

添加20px的 StatusBar高度