Example: Multi Page UI

MultiPageUI

You can find this example in Components sample.

CSHARP

Nested UIViews

I will elaborate on the problem and solution by building upon the example provided above.

Add an Action to first page

CSHARP

Problem

Actions such as UIViewActionEscape are registered when a UIView fades in. However, if you control the visibility of a UIView through a parent UIView, the actions of the child UIView will not be registered.

In this case, we are controlling visibility with the parent _modal and we never fade _modalPageFirst directly. This means the Action we added to _modalPageFirst will never activate.

Solution

To fix this issue, simply use AddChild function.

CSHARP

With this, the Actions of child _modalPageFirst will register/unregister in sync with the parent _modal. So when _modal fades in, the UIViewActionEscape with debug message will be registered and next escape input will print the message to the console.