iOS Question Navigation Bar back button without text

Marco Iannaccone

Member
Licensed User
Longtime User
I know I can completely remove the backbutton from the navigation bar, but I'd like t be able to keep the back arrow, but without any text.

I could, in Objective-C, do this:
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle"" style:UIBarButtonItemStylePlain target:nil action:nil];
but I'm not able to initialize the backbutton item using a NativeObject.
 

kozbot

Member
Licensed User
Longtime User
Sorry Erel, how exactly do you use it? Would it be on the first page? or the page you want the label to disappear from? I'm very confused.
I tried this, but it doesn't do anything useful.

B4X:
Private Sub pg_Disappear
    pg.RootPanel.RemoveAllViews
End Sub

Public Sub pg_Appear
    Page1_Resize(pg.RootPanel.Width, pg.RootPanel.Height)
End Sub
 
Upvote 0

kozbot

Member
Licensed User
Longtime User
Ah... That makes more sense. It doesn't work, but it makes more sense.

I need to get the previous page title to disappear when I'm on the next page, because it just looks ridiculous. The above doesn't work, unless I need to call it somewhere else or somehow else?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I need to get the previous page title to disappear when I'm on the next page, because it just looks ridiculous
Better write it to Apple as this is their design.

Works properly here:
B4X:
Sub Process_Globals
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page
   Private Page1Title As String = "My Title"
End Sub

Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.RootPanel.Color = Colors.White
   NavControl.ShowPage(Page1)
   
End Sub

Sub Page1_Click
   Dim p As Page
   p.Initialize("")
   p.RootPanel.Color = Colors.Red
   Page1.Title = ""
   NavControl.ShowPage(p)
End Sub

Sub Page1_Appear
   Page1.Title = Page1Title
End Sub
 
Upvote 0

Marco Iannaccone

Member
Licensed User
Longtime User
I have Page1 as first element in the navigation controller and Page2 as the second. I want the back button in Page2 to be without text.
I first used the Page2_Appear event for removing Page1 title when showing page two, but it didn't work (I suppose because the back button had already been initialized), and then tried doing the same thing in Page1_Desappear, and it didn't work either.

I then changed approach and removed Page1 title immediately after the call for showing Page2, after saving the title to a variable so that, using the Page2_Disappear event, I can set it back (I needed to save it since it can change due to the context), and this worked.

I remove Page1 title immediately showing Page2 because I don't want to see the title desappear and then get to the next page. The little delay is anyway present, with this approach, when getting back to Pag1.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…