このようUIViewのを作成し、あなたの願いとして、中心アイテムの高さを設定します。
そしてTabbarViewコントローラーで
。このビューをタブバーに追加するビューこのようにします。
UITabBar.appearance().shadowImage = UIImage()
customNavBar = NSBundle.mainBundle().loadNibNamed("CustomTabBarView", owner: self, options: nil)[0] as! UIView
bdNavBar.translatesAutoresizingMaskIntoConstraints = false
self.tabBar.addSubview(customNavBar)
カスタムタブバーに制約を追加します。
self.view.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: .Left, relatedBy: .Equal, toItem: self.view, attribute: .Left, multiplier: 1.0, constant: 0))
self.view.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: .Right, relatedBy: .Equal, toItem: self.view, attribute: .Right, multiplier: 1.0, constant: 0))
self.view.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: .Bottom, relatedBy: .Equal, toItem: self.view, attribute: .Bottom, multiplier: 1.0, constant: 0))
bdNavBar.addConstraint(NSLayoutConstraint(item: customNavBar, attribute: NSLayoutAttribute.Height, relatedBy: .Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1.0, constant: 50))
self.tabBar.bringSubviewToFront(customNavBar)
あなたは画面を共有できますか? –
質問のスクリーンショットを追加しました。ボタンは、タブバーの高さについて主に不思議に思うだけで、正しく配置されていません。それは静的で、ボタンのサイズはデフォルトですか? – DuckMan
あなたの要件についてはわからないが、このリンクがあなたに役立つことを願っています。 https://github.com/codepath/ios_guides/wiki/Creating-a-Custom-Tab-Bar –