iOSApplication.CurrentScreen

From Xojo Documentation

Revision as of 03:13, 19 July 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Read-Only Property (As iOSScreen )
iOSScreenValue = aiOSApplication.CurrentScreen

Supported on Mobile (iOS).

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

Notes

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

In most cases you will want to use the iOSView.PushTo method to display a new view over this initial view. This retains the view hierarchy and allows the back button to go back to the previous view.

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

Sample Code

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

Var myNewView As New MyView
App.CurrentScreen.Content = myNewView

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

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