I've managed to change the navigationbar height by using my own navigationbar, but the title is still centered. I want it to be at the 72px position from the left.
override func sizeThatFits(size: CGSize) -> CGSize {
return CGSizeMake(UIScreen.mainScreen().bounds.width, 56)
}
I used this to change the height but I didn't find a way to change the position of all the items. I tried to set the frame but I can't. I can't change the position of the button too.
i wanna look like this
Create a
UIView
object addUIButton
andUILabel
in it to show a similar view. Add this custom view into left bar button item of navigation controller.An example screen shot to visualise a custom view and related code:
Another solution is to simply indent the title:
Setting custom view with left align.
Setting custom view as leftBarButtonItem is not conveniently, because we will have a problems with back button.
Setting custom view as subview of navigationBar is not conveniently because:
So? I've just added width constraint to the customTitleView.
Inside of CustomTitleView class:
Then, inside of your ViewController:
And we have: