How can I change height of Navigation Bar - Swift 3
UPDATE 8/3/20: I posted this in 2016. A number of people have stated this no longer works so please use at your own risk. I am not working in iOS at the moment so I do not have an update handy. Best of luck!
Here is one way to do it:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let height: CGFloat = 50 //whatever height you want to add to the existing height
let bounds = self.navigationController!.navigationBar.bounds
self.navigationController?.navigationBar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height + height)
}
Change height of navigation bar ios
The hierarchy of UINavigationBar view is private so we can't manipulate it.We create our custom view and add into a Viewcontroller.
Change Navigation Bar Height
I dont think you can change size of navigationBar.
But this is how would i recommend you to do it.
Remove default navigation bar.
Create a view which is similar to a navigation bar like you design add constrains> leading,trailing,top and height for that
view. so basicly pin it to top, left and right with your design's
height.- Add 2 buttons left and right if needed which would look similar to navigation bar. add button constrains> leading, top, bottom and
width for left one and trailing,top, bottom and width right one. - Add a UILabel which would be your navigation bar title., add label constrains leading with left button, trailing with right button, top
and bottom with navigation view you created. Make uilabel text
centered.
Here you go u have your custom navigation bar.
On each controller all u have to do is CMD+C and CMD+V on the other controller add leading,trailing and top constrains.
Hope it helped.
How to create and change size height navigation bar iOS 11
I think you can't change it - not supported anymore. Here's the quote from Apple staff
Resizing the navigation bar (via any method, including subclassing) is
not supported, and neither is changing the frame of a navigation bar
that is owned by a UINavigationController (the navigation controller
will happily stomp on your frame changes whenever it deems fit to do
so). The navigation bar needs to be placed on the bottom edge of
the status bar, not underlapping the status bar, and with its natural
height.Finally, the internal layout of the
navigation bar is an implementation detail including all class names
and orderings. Any code that relies upon the ordering of the
navigation bar's subviews or the names of any of their classes is
likely to encounter issues in the future, as these are all private
details. Please do not rely upon them. If there are things you want to
do with a navigation bar that you cannot
A walk around is to use the image view then change its height.
Related Topics
Hide Separator Line on One Uitableviewcell
Ios 7 Textkit - How to Insert Images Inline With Text
Ineligible Devices Section Appeared in Xcode 6.X.X
Detect If the App Was Launched/Opened from a Push Notification
How to Create Ns_Options-Style Bitmask Enumerations in Swift
How to Receive Nsnotifications from Uiwebview Embedded Youtube Video Playback
Storyboard Doesn't Contain a View Controller With Identifier
How to Support Universal Links in iOS App and Setup Server For It
How to Change the Device Orientation Programmatically in iOS 6
Iterate Over Snapshot Children in Firebase
Retrieving Carrier Name from iPhone Programmatically
Xcode 9 Gm - Wkwebview Nscoding Support Was Broken in Previous Versions
Uitableview with Fixed Section Headers
Unexpected Cfbundleexecutable Key
Cgcontextdrawimage Draws Image Upside Down When Passed Uiimage.Cgimage