Lorenzo von Matterhorn Lorenzo von Matterhorn - 1 year ago 175
Swift Question

Changing the height of the Navigation bar iOS Swift

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.

I have no idea how to change this. Very new to iOS development.

Can anyone please help?

Answer Source

Try this :

import UIKit

class YourViewController: UIViewController {
var navBar:UINavigationBar=UINavigationBar()

override func viewDidLoad() {
    // Do any additional setup after loading the view.
    self.title="test test"

override func didReceiveMemoryWarning() {
    // Dispose of any resources that can be recreated.

func setNavBarToTheView()
    navBar.frame=CGRectMake(0, 0, 320, 50)  // Here you can set you Width and Height for your navBar
    navBar.backgroundColor=(UIColor .blackColor())
    self.view .addSubview(navBar)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download