iOS Question ShowPage method in Module Layout Issue

Mashiane

Expert
Licensed User
Longtime User
Hi there

I have come up with this method in my sub module, to enable me to just write the sub each time I want to show a page

B4X:
Public Sub ShowPage(nc As NavigationController, pg As Page, sTitle As String, vLayout As String, bHideBackButton As Boolean, bAnimated As Boolean)
    vLayout = LCase(vLayout)
    pg.Initialize("pg")
    pg.Title = sTitle
    pg.RootPanel.LoadLayout(vLayout)
    pg.HideBackButton = bHideBackButton
    nc.ShowPage2(pg,bAnimated)
End Sub

This seems to work as there is no error, however when I refer to the views e.g. Buttons in the view after this code is ran its like the layout did not load. I get an error that says object needs to be initialized for my views. I cant do this like this with b4i?
 
Top