View

The View namespace provides methods for showing and dismissing views.

static function View.push(Item page) → Item

static function View.push(element()->Item page) → Item

Push the page. Pushing is usually used to navigate a view heirarchy, and creates a "back" relationship between the pushed view and the pushing view. Pushed views are always maximized and replace the previous view.

You can pass an Item instance, or an Item element to push. The following two examples are equivalent:

View.push(new MyPage {})
View.push(MyPage)

The optional arguments to push are:

optional Item context: null

The context in which to push the view.

The context determines where in the application's view hierarchy the page is pushed. Zing searches the container chain, starting with the provided context, until it finds either a StackView instance or an Apple.TabView tab.

If it finds a StackView, the page is pushed into it, as though the StackView.push() method was called directly on it.

If it finds an Apple.TabView tab, the page is pushed at that point. This allows each tab to maintain its own navigation stack, which is what users normally expect.

If neither is found, or if the context is not provided, the page is pushed into the "global" navigation stack.

optional View.Transition transition: .Default

The transition to use for the push.

View.Transition.Default

Use the default transition, which is Navigate for a push(), and SlideUp for present().

View.Transition.Navigate

View.Transition.PushLeft

View.Transition.PushRight

View.Transition.PushUp

View.Transition.PushDown

View.Transition.SlideLeft

View.Transition.SlideRight

View.Transition.SlideUp

View.Transition.SlideDown

View.Transition.Fade

View.Transition.None

static function View.present(Item page) → Item

static function View.present(element()->Item page) → Item

Present the page modally.

You can pass an Item instance, or an Item element to present. The following two examples are equivalent:

View.present(new MyPage {})
View.present(MyPage)

The optional arguments to push are:

optional Item context: null

The context in which to present the view.

optional View.Transition transition: .Default

The transition to use for the present.

static function View.dismiss(Item page)

optional View.Transition transition: .Default

The transition to use for the dismiss. If a transition is not supplied the visual opposite of the push()/present() transition is used.

extension property View.StatusBar View.statusBar: .Default

View.StatusBar.Default

Show the project default statusbar, as specified in the project settings.

View.StatusBar.Dark

Show the dark style statusbar.

View.StatusBar.Light

Show the light style statusbar.

View.StatusBar.None

Do not show a statusbar.

extension property View.PresentationStyle View.presentationStyle: .Maximized

View.PresentationStyle.Maximized

The view is maximized to cover the entire available area.

View.PresentationStyle.PageSheet

On wide screens, such as an iPad or the iPhone 7+ shown below, the presented view partially covers the content below it. Any uncovered areas are dimmed.

On a non-wide screen, PageSheet behaves like Maximized.

View.PresentationStyle.FormSheet

On large screens, such as an iPad, the presented view is centered on the screen. The width and height of the view are smaller than the screen size, and uncovered areas are dimmed.

On non-large screens, FormSheet behaves like Maximized.

extension event View.dismissing()

extension event View.dismissed()

Emitted when a view is dismissed, either by explicitly calling View.dismiss(), or implicitly by a back button or key.

The dismissing() event is fired when the dismiss begins, and the dismissed() event once the dismiss transition animation has finished.

Both the dismissing() and dismissed() events are always emitted. If there is no dismiss transition, the dismissing() event is emitted, immediately followed by the dismissed() event.