Skip to content

TMSFMXNativeUINavigationController

Usage

The UINavigationController class implements a specialized view controller that manages the navigation of hierarchical content. This navigation interface makes it possible to present your data efficiently and also makes it easier for the user to navigate that content.

Published Properties

Property name Description
Color The background color of the NavigationController.
Title The title of the current page in the NavigationController.
Visible Shows / hides the NavigationController.

Methods

Method name Description
PushViewController(AViewController:TTMSFMXNativeUIViewController; AAnimated: Boolean); Pushes a ViewController on the stack with optional animation
PopViewController Pops the last added ViewController on the stack with optional animation.

Public Properties

Property name Description
NavigationController Returns a reference to the native iOS UINavigationController.

Published Events

Property name Description
OnDrawRect Event to perform custom drawing inside the NavigationController.

Pushing and popping pages (ViewControllers)

The NavigationController can be filled with Pages and has a toolbar at the top. The pages can be pushed and popped from the main NavigationController through code. You can add as many pages as you wish by adding a TTMSFMXNativeUIViewController for each page. Below is a sample with 3 pages.

Drop an instance of TTMSFMXNativeUINavigationController and 2 instances of TTMSFMXNativeUIViewController on the form. Set the title for each controller like the sample below:

TMSFMXNativeUINavigationController1.Title := First Page;
TMSFMXNativeUIViewController1.Title := Second Page;
TMSFMXNativeUIViewController2.Title := Third Page;
Add a TMSFMXNativeUIButton instance as a child of the first page, the TMSFMXNativeUINavigationController. In the OnClick event, add the following code:
TMSFMXNativeUINavigationController1.PushViewController(TMSFMXNativeUIViewController1, True);
This will push the second page in place and update the toolbar with a back button. The back button will allow you to navigate to the previous page. This can also be done with the second page by dropping a button on the first page and adding the code:
TMSFMXNativeUINavigationController1.PushViewController(TMSFMXNativeUIViewController2, True);
If you press on the first button, and on the second button, the NavigationController will push 2 ViewControllers in place and update back button to return to the second page. The hierarchy is now updated with 3 pages. To return one step in the hierarchy, call
TMSFMXNativeUINavigationController1.PopViewController(True);