我正在尝试为我的应用程序更改导航栏的高度。目前,高度固定为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) } }