iOS Question How to change the caption of the back button?

jo1234

Member
Licensed User
Hi,

how can I change the caption of the back button?
I do not want to add a different button, but only localize the caption of the regular back button.

Thanks!
 

jo1234

Member
Licensed User
If the previous page title is long, the back button shows "Back" instead of the previous page title.
What bothers me is that the "Back" text is not in the default language of the phone but always in English.

The obvious work-around to localize the "Back" text would be to change the long page title to the local translation of "Back" before calling the next page (that works) and change the page title back to the long title when the user returns to the previous page. Not very elegant.

It would be better to programmatically set the text of the back button.

http://stackoverflow.com/questions/835607/how-to-change-text-on-a-back-button suggests this code:
B4X:
self.navigationItem.backBarButtonItem =[[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil] autorelease];
Just to note, the back button text is set on the view which the next controller was pushed from, not the view controller you currently have shown.

Would that be an option in B4i?

Thanks a lot!
 

jo1234

Member
Licensed User
Unfortunately not.
If I set the Page.TopLeftButtons I cannot swipe back to the previous page.

What I would like to change is the value for this item that is shown in the watch window:
B4X:
page._NavigationItem._abbreviatedBackButtonTitles.Description
with the value
B4X:
<__NSArrayI 0x16e6f4b0>(
Back,

)
Thanks for your efforts!
 
Top