更改导航栏iOS Swift的高度 [英] Changing the height of the Navigation bar iOS Swift
本文介绍了更改导航栏iOS Swift的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为我的应用更改导航栏的高度。
目前高度固定为44.我可以改变Xcode的宽度而不是高度。
I am trying to change the height of there navigation bar for my app. Currently the height is fixed to 44. I can change the width from Xcode but not the height.
我不知道如何改变它。 iOS开发的新功能。
I have no idea how to change this. Very new to iOS development.
有人可以帮忙吗?
推荐答案
试试这个:
import UIKit
class YourViewController : UIViewController {
var navBar: UINavigationBar = UINavigationBar()
override func viewDidLoad() {
super.viewDidLoad()
self.setNavBarToTheView()
// Do any additional setup after loading the view.
self.title = "test test"
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func setNavBarToTheView() {
self.navBar.frame = CGRectMake(0, 0, 320, 50) // Here you can set you Width and Height for your navBar
self.navBar.backgroundColor = (UIColor.blackColor())
self.view.addSubview(navBar)
}
}
这篇关于更改导航栏iOS Swift的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文