Transparent Page

narek adonts

Well-Known Member
Licensed User
Code to show a page with transparent background (or Alpha).
That means that the page under will be visible.


You need to change the NewPage background color to transparent or any alpha to see the effect.

B4X:
Private Sub ShowPage(Parent as Page, NewPage as Page)

       Dim no As NativeObject = Parent
       Dim no2 As NativeObject=NewPage

       no2.SetField("ModalTransitionStyle",0)   'You can change the animations style by changeing the 0 to 1,2,...

no.SetField("providesPresentationContextTransitionStyle",True)
no.SetField("definesPresentationContext",True)
no2.SetField("ModalPresentationStyle",5)  ' You can change the mode by changing the 5 to 6,7,..

no.RunMethod("presentModalViewController:animated:",Array(NewPage,True))

' you can disable the animation by setting false

End Sub



Private Sub HidePage(Parent as Page)

        Dim no As NativeObject=Parent
    no.RunMethod("dismissViewControllerAnimated:completion:",Array(True,Null))
'you can disable the animation by setting false
End Sub
You can change a lot of Styles.

Narek
 

Keith Yong

Active Member
Licensed User
Code to show a page with transparent background (or Alpha).
That means that the page under will be visible.


You need to change the NewPage background color to transparent or any alpha to see the effect.

B4X:
Private Sub ShowPage(Parent as Page, NewPage as Page)

       Dim no As NativeObject = Parent
       Dim no2 As NativeObject=NewPage

       no2.SetField("ModalTransitionStyle",0)   'You can change the animations style by changeing the 0 to 1,2,...

no.SetField("providesPresentationContextTransitionStyle",True)
no.SetField("definesPresentationContext",True)
no2.SetField("ModalPresentationStyle",5)  ' You can change the mode by changing the 5 to 6,7,..

no.RunMethod("presentModalViewController:animated:",Array(NewPage,True))

' you can disable the animation by setting false

End Sub



Private Sub HidePage(Parent as Page)

        Dim no As NativeObject=Parent
    no.RunMethod("dismissViewControllerAnimated:completion:",Array(True,Null))
'you can disable the animation by setting false
End Sub
You can change a lot of Styles.

Narek
Narek, you are very very helpful! I have been looking for it 2 weeks and keep searching around. Because I planning to create a custom alert message which need to be cover the whole page (including the navigation bar and status bar). thank you!
 
Top