iOS Question Page_Resize Event

ilan

Expert
Licensed User
i have read the thread Application life cycle but 1 thing is not clear to me.

On first start the Application_Start will be raised. this will be raised only once when the process starts.
now i would like to know if at the first time the process starts will ALWAYS also the Page Resize event be raised?

i know that the resize event will also be raised in different scenario like an incoming call but i just need to know if at process start it will always be raised because i am using a boolean FIRSTTIME in it and change it to false but i need to do some stuff when it is true and i am doing it in the resize event.

thanx, ilan
 

sorex

Expert
Licensed User
yes, it happends when the app becomes visible.

and it's the only place/way you can rely on the screen dimensions.

on app start they can be wrong sometimes.

the boolean method works fine as I used it like that aswell

B4X:
Private Sub Page1_Resize(Width As Int, Height As Int)
    If initializeDone=False Then
        remove_Ads=False
        ads.Initialize
        game.Initialize(Page1)
        initializeDone=True
    End If
End Sub
 

Erel

Administrator
Staff member
Licensed User
I use this code in some of the examples when I want to run something after the page was resized once:
B4X:
Private Sub Application_Start (Nav As NavigationController)
...
If Page1.RootPanel.Width = 0 Or Page1.RootPanel.Height = 0 Then
        Wait For Page1_Resize(Width As Int, Height As Int)
End If
'page size will be correct at this point. Do remember that it can later change.
'do whatever you need here

End Sub
 
Top