vara
vara

Reputation: 836

Navigation bar Height is not changed in ViewDidLoad() programmatically?

Hi I have tried to change the UINavigationBar height progrmatically it has not changed in viewDidLoad. but its working viewDidAppear() but once I have do my application in background after if open the app it has not changed it going default height.please any one help. thanks advance.

  let bounds = self.navigationController!.navigationBar.bounds
   self.navigationController!.navigationBar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: 66)

Upvotes: 0

Views: 333

Answers (1)

Jack
Jack

Reputation: 14329

Add UINavigationBar extension with your viewcontroller

extension UINavigationBar {
    override open func sizeThatFits(_ size: CGSize) -> CGSize {
        return CGSize(width: UIScreen.main.bounds.size.width, height: 80.0)
    }
}

Upvotes: 1

Related Questions