iOS Scrollable Area

From Xojo Documentation

Revision as of 18:31, 25 August 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A scrollable area allows users to scroll a container that otherwise has more content than can fit in the visible area. When users interacts with content in the scrollable area, horizontal or vertical scroll indicators briefly display to show users that they can scroll around to reveal more content. Other than the transient scroll indicators, a scrollable area has no visual appearance.

Refer to iOSScrollableArea in the Language Reference for the full list of events, properties and methods.



This is a Container Control to display in the scrollable area. If the container has more content than can fit in the view, the user will be able to scroll to see it.


To use a scrollable area, drag the control from the Library to the layout. In the Inspector choose an existing Container Control for the Content property. Use the Content property to get a reference to the Container Control at runtime so that you can call methods on it (or access its controls). For example:

// Get reference to container control
Var cc As MyContainer
cc = MyContainer(ScrollableArea1.Content) // cast to MyContainer

// Now you can call methods on it

There may be situations where you need to dynamically alter the size of the Container Control at run-time, perhaps because the size of its content has increased. You can do this by adding a Height constraint to the Content area like this:

Var newHeight As Integer = 2000

Var contentConstraint As iOSLayoutConstraint
contentConstraint = New iOSLayoutConstraint(ScrollableArea1.Content, _
iOSLayoutConstraint.AttributeTypes.Height, _
iOSLayoutConstraint.RelationTypes.Equal, _
Nil, _
iOSLayoutConstraint.AttributeTypes.None, _
1, _


Example Projects

  • Examples/iOS/Controls/ScrollableArea

See Also

iOSScrollableArea class; UserGuide:iOS Container Control, UserGuide:iOS UI topics