我正在尝试更改应用程序中导航栏的高度。 当前的高度固定为44。我可以从Xcode更改宽度,但无法更改高度。
我不知道该如何更改。对iOS开发非常陌生。
有人能帮帮我吗?
我正在尝试更改应用程序中导航栏的高度。 当前的高度固定为44。我可以从Xcode更改宽度,但无法更改高度。
我不知道该如何更改。对iOS开发非常陌生。
有人能帮帮我吗?
试试这个:
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)
}
}