MobileApplication.CurrentLayout

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As iOSLayout )
iOSLayoutValue = aMobileApplication.CurrentLayout

Supported on Mobile.

The currently displayed layout. You can use this property to access the current layout so that you can change its content.

Notes

The layout is typically the base (first) screen that was displayed in a phone app. It may also refer to a Split screen or a Tab screen.

In most cases you will want to use the MobileScreen.Show method to display a new screen over the initial screen. This retains the screen hierarchy and allows the back button to go back to the previous screen.

There may be times when you need to replace the entire screen/layout and do not want the screen hierarchy. For example, you may have an initial login screen that is displayed but after the user successfully logs in and you want to replace that screen with another screen so that the back button does not return the user to the login screen.

Sample Code

You can directly change the layout content like this to swap in a new screen:

Var myNewScreen As New MyScreen
App.CurrentLayout.Content = myNewScreen

Use the same technique to swap in a new MobileScreen, iOSLayout, iOSSplitView or iOSTabBar. For example, this swaps in a new screen:

Var s As New MySpecialScreen
App.CurrentLayout.Content = s.Content