I am currently trying to change the back button text of a subview that is loaded of a tablecell touch. However even with the way I am trying to implement it it still shows the parents title in the back button.
I am trying to load a new value into the back button inside viewdidload method like so
UIBarButtonItem *myBarButtonItem = [[UIBarButtonItem alloc] init];
myBarButtonItem.title = @"Back";
self.navigationItem.backBarButtonItem = myBarButtonItem;
[myBarButtonItem release];
however its not working.
Turn on Back Tap Check that you have the latest version of iOS on your iPhone 8 or later. Go to Settings > Accessibility > Touch, and tap Back Tap. Tap Double Tap or Triple Tap and choose an action. Double or triple tap on the back of your iPhone to trigger the action you set.
Storyboard. You can also set this in the Storyboard. Select UINavigationBar and select the Attributes Inspector tab. Then you can change those two images under Back and Back Mask attributes.
Go to your Navbar settings and find the navigation item you want to hide for a particular page. Click to edit and assign it a classname. You could assign it something like "hide-navigation-item."
You need to change self.navigationItem.backBarButtonItem
from previous view, not current view (I know, it seems to be a little bit illogical). For example, in your table view you can do the following:
- (void)viewDidLoad
{
[super viewDidLoad];
[self setTitle:@"My title"];
UIBarButtonItem *boton = [[UIBarButtonItem alloc] initWithTitle:@"Custom back button text" style:UIBarButtonItemStyleBordered target:self action:@selector(mySelector:)];
self.navigationItem.backBarButtonItem = boton;
[boton release];
}
This is where the documentation is not so clear until you have read and re-read and play around with each settings.
To change the title of the default back button add this line in viewDidLoad()
self.navigationController.navigationBar.topItem.title = @"Your Label";
If you want the button to be invisible - then set the value to @""
empty string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With