iOS Container Control

From Xojo Documentation

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

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 Control from the Insert menu or Insert main toolbar button. Drag the controls you want onto its layout. To use the Container Control on a View, drag it from the Navigator onto the View layout. Container Controls are also used with Scrollable Areas.


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 Views, 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 View layouts. Instead of adding dozens (or hundreds) of controls onto a View, 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 View, it is much easier to work with while at the same time benefitting from better code organization and data separation.


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 view.

The controls on the container cannot be directly edited within the View itself. You have to go back to the Container Control to edit its controls.

If your Container Control is larger than the available view area then some control won't be displayed. In this situation you should instead add a Scrollable Area to the View 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 View area.

Custom Table Cell

A Custom Table Cell is used with a Table 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

iOSContainerControl, iOSScrollableArea, iOSCustomTableCell classes; UserGuide:iOS Scrollable Area, UserGuide:iOS UI topics