Created
January 20, 2016 23:24
-
-
Save thornpig/01e63fad50e848cb2f4b to your computer and use it in GitHub Desktop.
To set the back button title for a view controller without changing it's title
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To set the back button title for a view controller without changing it's title you use: | |
Objective-C: | |
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:self.navigationItem.backBarButtonItem.style target:nil action:nil]; | |
Swift: | |
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain, target: nil, action: nil) | |
To be clear, this is done on the view controller that you would see if you hit the back button. | |
i.e. instead of seeing '< Settings' you want to just see '<' then on your SettingsViewController you would put this in your init. | |
Then you don't get any of the problems of the title not showing when you're looking at the view controller itself. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment