When I push a UIViewController
, it has some title in back button at new UIViewController
, if the title has a lot of text, It does not look good in iPhone 4s So I want to remove it.
If I add some code in prepareForSegue
function, it is going to be a trouble.
Any better way to achieve this?
Swift 3:
Swift 4
Just copy this code in
didFinishLaunchingWithOptions launchOptions
If you want back arrow so following code put into
AppDelegate
file intodidFinishLaunchingWithOptions
method.For Objective-C
For Swift
Another option give below.
In
Objective C
In
Swift
UPDATE :
UPDATE SWIFT 4.1 :
Using Offset
So may be your problem has been solve.
Happy coding.
Just use this:
So call this method in viewDidLoad:
I would like to share a solution that works for me. Also, it can be adjusted base on your needs and requirements.
Note, in my case, I use a storyboard to specify CustomNavigationBar
Swift 4.2
I usually add or change the back button in viewDidLoad of the UIViewController.
Something like that should work:
Don't forget to change and implement the function that it's called to close the view.
Even easier, just change the title: