UserGuide

Mobile Container

From Xojo Documentation

(Redirected from UserGuide:iOS Container Control)

There are two project items that can be used as containers for other controls. They are: Container control and MobileTableCustomCell. For creating a layout, they both work they same: you drag the controls you want into the layout for the Container control or the [MobileTableCustomCell]].

Container Control

A Container control is a great way to create a collection of controls that can be treated as a single control to drag onto a layout. You can add a Container control to your project by choosing Container from the Insert menu or Insert main toolbar button. Drag the controls you want onto its layout. To use the Container control on a Screen, drag it from the Navigator onto the Screen layout. Container controls are also used with Scrollable Areas.

Benefits

There are many great reasons to use Container controls in your projects instead of creating windows with lots and lots of controls.

Reusable Controls

Since a Container control can be easily added to Screens, you can reuse these controls in multiple places without recreating the entire layout and any required code. The Container control itself also makes it easy to encapsulate any specific methods or properties that are needed to tie all the controls together.

Custom Controls

Even more generically, you can create your own custom controls using Container controls.

Simplify Layouts

Use a Container control to simplify your Screen layouts. Instead of adding dozens (or hundreds) of controls onto a Screen, which makes it more complex and potentially adds lots of fragile dependencies, instead group your layout into multiple Container controls, each having only the controls they need. With just a few Container controls on the Screen, it is much easier to work with while at the same time benefitting from better code organization and data separation.

Usage

Once you've added a Container control to your project you can add controls to design its layout. You can then drag the Container control onto a view and the controls will appear on the Screen.

The controls on the Container cannot be directly edited within the Screen itself. You have to go back to the Container control to edit its controls.

If your Container control is larger than the available Screen area then some control won't be displayed. In this situation you should instead add a Scrollable Area to the Screen and then assign your Container control to the Content property of the Scrollable Area. The Scrollable Area lets the users roll to see all the controls when the Container is larger than the Screen area.

Custom Table Cell

A MobileTableCustomCell is used with a iOSMobileTable to display a custom cell containing your own controls and layout. For more information on this refer to the Custom Cell Data section of the Working with Tables topic.

See Also

MobileContainer, MobileScrollableArea, MobileTableCustomCell classes; UserGuide:Mobile Scrollable Area, UserGuide:iOS User Interface Controls topics