Skip to content

iOS Framework Improvements

The iOS Framework has received a number of additions and improvements in Xojo 2026r2. Some of them will be mandatory for your existing iOS apps created with Xojo, while others are targeted to improve your iOS apps’ UI designs and functionality. Let’s talk about them!

Behind the Scenes…

Let’s start with a non-visible change, but a major and important one. In fact, this responds to one of Apple’s requirements for iOS apps:

“In the next major release following iOS 26, UIScene lifecycle will be required when building with the latest SDK; otherwise, your app won’t launch.”

Xojo has made the necessary underlying changes in the iOS Framework, and starting with Xojo 2026r2, all iOS apps are compiled/built so they can be run and published meeting this requirement.

What does this mean for you in practice? For any existing Xojo iOS projects, all you need to do is rebuild them with the current version of Xojo. This guarantees that the apps implement the required UIScene lifecycle and can be run without issues both on the iOS simulators and real iOS devices using iOS 26+.

MobilePopupMenu Arrives to iOS

Until now, making simple selections in iOS projects required a complex UI design involving navigation to different screens, the use of tables, containers, etc. Starting with Xojo 2026r2, we have simplified everything with the new MobilePopupMenu control.

In fact, the feature also uses a newly added class for the displayed menu entries: MobileMenuItem (more on this a bit later). It is also possible to add new entries to the menu as text, if you prefer. No matter how entries are added to the PopupMenuControl’s menu, the underlying items are MobileMenuItem instances, and these are the ones received in the SelectionChanged event handler.

You can populate the MobilePopupMenu entries at design time via the associated Inspector Panel, and select the default SelectedRowIndex value. Of course, you can do the same at runtime and change the control’s menu entries as you would with the equivalent control on Desktop.

MobileMenuItem

This new class added to the iOS Framework lets you create menu entries for the MobilePopupMenu, as well as for the newly added Menu properties on MobileButton and MobileToolbarButton.

Like its Desktop counterpart, it is possible to create hierarchical menu entries and assign icons to each item. What is specific to MobileMenuItem on iOS are the Destructive (Boolean) and DisplayMode (Enum) properties. When a MobileMenuItem instance is set to Destructive, it will be displayed as such under the iOS Design Guidelines, giving users a clear visual clue about the potentially destructive action.

The DisplayMode property can be set as Regular (the usual dropdown displaying of a menu) or as Palette. With Palette, child entries are presented in a smaller palette with horizontal navigation, which is especially recommended for tight UI designs where options are shown as icons.

If a MobileMenuItem is set to a MobilePopupMenu, it will not display the icons for the menu entries and will discard any child hierarchies (submenus), as is also the case for DesktopPopupMenu and WebPopupMenu. On the other hand, MobileButton and MobileToolbarButton are able to support submenus and will display the associated icons for every menu entry.

MobileButton

As previously noted, this control has new properties related to displaying a menu. It is possible to set the menu (MobileMenuItem instance) at runtime, and the behavior is controlled by the DisplayMenuAsAction (Boolean) property.

When DisplayMenuAsAction is set to False (the default), the Button fires its Pressed event as usual, and the menu is displayed only after a long press on the button. The menu selection made by the user will be received through the new MenuItemSelected(menu As MobileMenuItem) event handler that can be implemented on the button instance itself. All in all, this provides a good way for the button to react to two different user interactions.

If the DisplayMenuAsAction property is set to True, the associated menu is presented when the button is pressed. In this case, the Pressed event handler will not fire, only its MenuItemSelected (menu as MobileMenuItem) handler will fire after the user makes a selection in the menu.

MobileToolbarButton

MobileToolbarButton also has the new Menu and DisplayMenuAsAction properties, and these behave in the same way as described above. The main difference is that, in this case, the MenuItemSelected event handler needs to be implemented in the containing Screen instance for the NavigationBar to which the MobileToolbarButton has been added, just as the pre-existing ToolbarButtonPressed event handler was.

Badges

In addition to the support of menus, MobileToolbarButton also got the ability to display badges. This is useful in order to simplify many mobile apps UI designs.

The information shown in the badge is set through the MobileToolbarButton.BadgeText property. If this property is set to an empty string, the badge will not be displayed. In addition, there are other properties you can use to customize the badge’s appearance:

  • BadgeColor As ColorGroup. Set the background color for the badge.
  • BadgeTextColor As ColorGroup. Set the color for the text displayed in the badge.
  • BadgeTextFont As Font. Set the font, style and font size to be used by the text in the badge.

In Summary

The new iOS Scenes based lifecycle will keep your apps in compliance with the requirement from Apple for future iOS releases beyond iOS 26, and we hope you will find the new menu items useful additions to simplify your iOS UI designs.

We are interested to know more about how you use these features, and invite you to share your iOS stuff on the Xojo Forum iOS channel!

Special thanks to Xojo MVP Jérèmie Leroy, he is always pushing and helping improve Xojo’s iOS support.

Javier Menendez is an engineer at Xojo and has been using Xojo since 1998. He lives in Castellón, Spain and hosts regular Xojo hangouts en español. Ask Javier questions on Twitter at @XojoES or on the Xojo Forum.