Version14.0.0
- 14.0.0latest
- 13.4.1not in this version
- 13.4.0not in this version
- 13.3.1not in this version
- 13.3.0not in this version
- 13.2.0not in this version
- 13.1.1not in this version
- 13.1.0not in this version
- 13.0.1not in this version
- 13.0.0not in this version
- 12.8.0not in this version
- 12.7.1not in this version
- 12.7.0not in this version
- 12.6.4not in this version
- 12.6.3not in this version
- 12.6.2not in this version
- 12.6.1not in this version
- 12.6.0not in this version
- 12.5.1not in this version
- 12.5.0not in this version
- mainunreleasednot in this version
Titanium.App.iOS.SceneProxy
Extends Titanium.Proxy
Proxy object representing a UIWindowScene in a multi-scene iOS application.
A SceneProxy provides access to a single UIWindowScene instance and its properties. Scene proxies are obtained via Titanium.App.iOS.currentScene, Titanium.App.iOS.scenes, Titanium.App.iOS.focusedScene, or the <Titanium.UI.Window.scene> property.
Multi-scene support is available on iOS 13 and later. The Titanium SDK includes
a default UIApplicationSceneManifest in the generated Info.plist with
UIApplicationSupportsMultipleScenes set to true and a single scene configuration
named "Default Configuration" with delegate class TiApp.
To add additional scene configurations (e.g., for CarPlay or custom window scenes),
add them under the <ios><plist><dict> section in your tiapp.xml:
<ios>
<plist>
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
[string](api:Global.String)Default Configuration</string>
<key>UISceneDelegateClassName</key>
[string](api:Global.String)TiApp</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
</ios>
In single-scene apps (iOS versions prior to 13.0 or apps without a scene manifest),
currentScene returns null and scenes returns an empty array.
Example
// Get the current scene
var scene = Ti.App.iOS.currentScene;
Ti.API.info('Scene ID: ' + scene.sceneId);
Ti.API.info('Scene Name: ' + scene.sceneName);
Ti.API.info('Active: ' + scene.isActive);
Ti.API.info('Foreground: ' + scene.isForeground);
Ti.API.info('Primary: ' + scene.isPrimary);
Ti.API.info('Key (focused): ' + scene.isKey);
// Get trait collection info
var traits = scene.traitCollection;
Ti.API.info('UI Style: ' + traits.userInterfaceStyle);
Ti.API.info('Horizontal Size Class: ' + traits.horizontalSizeClass);
Ti.API.info('Vertical Size Class: ' + traits.verticalSizeClass);
Properties 11
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
The unique identifier of the scene (alias for sceneId).
Convenience accessor that returns the same value as Titanium.App.iOS.SceneProxy.sceneId.
This is the persistentIdentifier of the scene's UISceneSession.
Whether the scene is currently active and receiving input.
Whether the scene is in the foreground (visible but may not be active).
Whether this scene's window is the one the user is currently interacting with.
Returns true when this scene's window was the last window to receive a touch event.
This is the most reliable way to determine which scene has input focus in
multi-scene mode (iPad Split View, Slide Over).
Important: In iPad Split View, both scenes report isKeyWindow as true
and activationState as foregroundActive simultaneously. The isKey property
uses hit-test tracking instead, making it a reliable focus indicator.
For the same information at the module level, use Titanium.App.iOS.focusedScene which returns the focused scene proxy directly.
Whether this scene is the primary (first) scene.
Returns true for the scene that was launched first or is designated as
the primary scene in the scene configuration.
The unique identifier of the scene.
The persistentIdentifier of the scene's UISceneSession.
This value uniquely identifies the scene across its lifetime.
The configuration name of the scene.
The name of the UISceneConfiguration used to create this scene.
Defaults to "Default Configuration" if no custom name is set.
The trait collection for this scene.
Returns a dictionary with the scene's UITraitCollection properties:
userInterfaceStyle(Number): The user interface style. One of 0 (Unspecified), 1 (Light), or 2 (Dark).horizontalSizeClass(Number): The horizontal size class. One of 0 (Unspecified), 1 (Compact), or 2 (Regular).verticalSizeClass(Number): The vertical size class. One of 0 (Unspecified), 1 (Compact), or 2 (Regular).displayScale(Number): The display scale factor.layoutDirection(Number): The layout direction. One of 0 (Left to Right), 1 (Right to Left).
Returns null if the scene does not have a window or on iOS versions prior to 13.0.
The root window proxy for this scene.
Returns the Titanium.UI.Window proxy for the root view controller of this scene.
Returns null if the scene does not have a window.
Methods 4
Inherited from Titanium.Proxy
Adds the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. 4 fields
|
applyProperties
since 3.0.0Inherited from Titanium.Proxy
Applies the properties to the proxy.
| Parameters | Type | Description |
|---|---|---|
| props | Dictionary | A dictionary of properties to apply. |
Inherited from Titanium.Proxy
Fires a synthesized event to any registered listeners.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| event? | Dictionary | A dictionary of keys and values to add to the Titanium.Event object sent to the listeners. |
Inherited from Titanium.Proxy
Removes the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to 4 fields
|
Events 4
Fired when this scene is about to resign the active state.
Fires when the scene is about to lose its active status, for example when a system overlay (like the notification center) covers the scene or when the user switches to another scene. This is the per-scene equivalent of the legacy pause event and mirrors Titanium.UI.Window.blur at the scene level.
Add a listener via scene.addEventListener('blur', fn).
| Event properties | Type | Description |
|---|---|---|
| sceneId | String | The unique identifier of the scene. |
| scene | Titanium.App.iOS.SceneProxy | The scene proxy that is resigning active. |
Fired when this scene becomes active and can receive user input.
Fires when the scene transitions to the active state, meaning it is in the foreground and receiving user input events. This is the per-scene equivalent of the legacy resumed event and mirrors Titanium.UI.Window.focus at the scene level.
Add a listener via scene.addEventListener('focus', fn). The
listener fires only for this scene, not for other scenes in the app.
| Event properties | Type | Description |
|---|---|---|
| sceneId | String | The unique identifier of the scene. |
| scene | Titanium.App.iOS.SceneProxy | The scene proxy that became active. |
Fired when this scene has entered the background.
Fires when the scene is no longer visible on screen. This can happen when the user switches to another app or when the scene is dismissed. This is the per-scene equivalent of the legacy paused event.
Add a listener via scene.addEventListener('paused', fn).
| Event properties | Type | Description |
|---|---|---|
| sceneId | String | The unique identifier of the scene. |
| scene | Titanium.App.iOS.SceneProxy | The scene proxy that entered the background. |
Fired when this scene is about to enter the foreground.
Fires when the scene transitions from the background to the foreground, meaning it becomes visible on screen but may not yet be active. This is the per-scene equivalent of the legacy resume event.
Add a listener via scene.addEventListener('resumed', fn).
| Event properties | Type | Description |
|---|---|---|
| sceneId | String | The unique identifier of the scene. |
| scene | Titanium.App.iOS.SceneProxy | The scene proxy that is entering the foreground. |