Skip to content

New iOS Table Features in Xojo

Making iOS apps just got a lot easier with the updates and enhancements to to the Table control in Xojo 2016r2. New features include:

  • Scroll to a specific row in the table
  • Row actions
  • Row re-ordering
  • Row editing
  • Custom cells

Scroll

You can now easily scroll the table (with animation) to a specific section and row using the iOSTable.ScrollToRow method. The following code scrolls to section 2, row 10 with animation and leaves the selected row in the middle of the table:

myTable.ScrollToRow(2, 10, True, iOSTable.ScrollPositions.Middle)

Row Actions

Row actions are what appear when the user swipes left across a row in the table. For example, if you swipe left across an email message in the Mail app, you’ll see “More”, “Flag” and “Trash” buttons. Xojo row action buttons are added using the iOSTableRowAction class in conjunction with the iOSTable.ActionsForRow event. When the user selects one of the buttons, then the iOSTable.RowAction event is called.

Row Actions

Row Editing and Re-Ordering

Both row editing and row re-ordering are enabled by putting the table into “editing” mode. You do this by setting the iOSTable.EditingEnabled property to True. Row editing displays “+” and “-” widgets to the left of each row that can be used to add and remove rows in the table. Row re-ordering displays a “drag” control to the right of each row that you can drag around to move the row within the table.

Row editing uses the iOSTableDataSourceEditing interface and row re-ordering uses the iOSTableDataSourceReordering interface.

Row Editing and Re-ordering

Custom Cells

Perhaps the most significant change to iOSTable is that you can now add your own custom cells. This means that a table cell can contain any collection of controls, designed however you want. To use this powerful feature, you add an iOSCustomTableCell class to your project and drag the controls that you want to it. Then when you add rows (using a data source or manually), you can provide the custom table cell. This allows you to have tables that consist of multiple columns, buttons, switches, edit fields or whatever else your design requires.

Custom Cells

To learn more about these powerful iOS Table features, be sure to read the Working with Tables topic in the Xojo Dev Center and check out the examples included with the Xojo download: iOS/Controls/Table.