Skip to content
Titanium SDK
Version13.0.0

You are reading 13.0.0. See this page in 13.4.1.

Titanium.UI

moduleAndroidiPhoneiPadmacOSsince 0.4

Extends Titanium.ModuleTitanium.Proxy

The main Titanium.UI module.

The UI module is responsible for native user-interface components and interaction inside Titanium. The goal of the UI module is to provide a native experience along with native performance by compiling Javascript code into their native counterparts as part of the build process.

Design

The UI module is broken down into 3 major area:

  • Views - Views are containers that host visual elements such as controls or other views. Views can have their properties customized, such as their border color and radius, can fire events such as swipe events or touches, and can optionally contain a hierarchy or other views as children. In Titanium, most views are specialized to perform both a visual function and set of interaction behaviors such as Table View or Coverflow View. Views are always named with the suffix View.

  • Controls - controls, or sometimes referred as widgets, are visual elements such as sliders, buttons and switches. They provide a visual element which has a defined behavior and typical have special configuration and special events. Controls themselves are views and also inherit a views properties, functions and events.

  • Windows - Windows are typically top-level visual constructs that are the main part of your interface. An application will always have at least one window and windows can take different shapes and sizes, can have display and interaction properties such as fullscreen or modal and can be customized, such as changing their opacity or background color. Windows themselves are views and also inherit a views properties, functions and events. There are a few specialization of Windows such as a Tab Group which offer additional behavior beyond the basic Window. It is considered a best practice to use a NavigationWindow as the root of your application.

Titanium uses the Factory Pattern for constructing objects and a general naming pattern for APIs. For example, to construct a Alert Dialog, you call the method Titanium.UI.createAlertDialog. To create a TextArea, you call the method Titanium.UI.createTextArea. Once an object is created, it will be available until it goes out of scope.

Optimizations

UI objects are optimized by Titanium to not be realized into the drawing context and placed into the device UI surface until needed. That means that you can create UI objects, set their properties and add them to their hierarchy without much worry about memory or performance. When the native drawing surface needs to render a specific view or control, Titanium will automatically create the view as needed. Additionally, Titanium is optimized to also release memory once the view is no longer needed, on screen or in low memory situations. However, it's a good idea to help Titanium along in certain cases where you are no longer using objects. For example, you should call close on a Window instance when you are no longer using it. You can safely call open on the window again to re-open it.

Global Context

Prior to the release of Titanium SDK 9.0.0.GA any variable declared in app.js or alloy.js was added to a global scope. This however is no longer the case since 9.0.0.GA. However it is still possible to add variables to a global scope by adding global. in front of any variabled declared in app.js or alloy.js. However you should be careful with adding variables to global context because anything added to the global context will not be garbage-collected.

In Alloy the recommended way to add global context is Alloy.Globals.

Portability

Titanium components are designed to be portable across as many platforms as it supports. However, there are cases where a device either does not support a specific feature or capability or where it support additional functionality. For cases where the device OS supports capabilities that other platforms do not, we attempt to place those capabilities in a separate namespace, such as Titanium.UI.iOS. However, in cases where the control is in a common namespace and support additional features, we continue to place that functionality directly on the object.

Events

Event listeners must be defined before their respective events are likely to be fired, otherwise they are not guaranteed to be called. The open and focus Window event listeners, for instance, must be defined before the window is opened.

Evaluating events as late as possible while bearing the above consideration in mind, however, can significantly improve application responsiveness. For example, an event listener for a click event may be defined after the parent window has been opened.

Adding eventListeners in Alloy makes sure they are bound before they are fired.

Colors

Many UI components have properties that control their color.

Colors may be specified as a hex triplet to determine the red, green and blue channels. Thus, '#000000' is specified for black, '#ff0000' for red, '#00ff00' for green, '#0000ff' for blue, and '#ffffff' for white, etc. A channel may be abbreviated when its two hex digits are identical, such as '#000', '#f00', '#0f0#', '#00f' and '#fff' for the above colors, respectively.

An additional alpha channel is supported as a prefix to the hex triplet (ARGB or AARRGGBB). So, to make the purple-like color '#ff00ff' semi-opaque, you could use an alpha value of '55', giving, '#55ff00ff' or '#5f0f'. Please note that both iOS and Android use ARGB format, while typical CSS supports RGBA.

Note that while the pound symbol, #, is not mandatory on iOS when using the hex triplet format, it is recommended to include it to provide compatibility with other platforms.

iOS and Android also accept colors specified in the form, rgb(R,G,B) and rgba(R,G,B,A), with the color channels inside the parethesis represented by integer numbers between 0 and 255 and the alpha channel by a float number between 0 and 1.0 (transparent to opaque, respectively). For example, an opaque purple could be obtained using 'rgb(255,0,255)' and a semi-opaque purple using 'rgba(255,0,255,0.3)'. Note that although this format will work if the rgb or rgba prefix is omitted, this is not officially supported and thus not recommended.

Alternatively, the following set of color names are recognized.

'aqua', 'black', 'blue', 'brown', 'cyan', 'darkgray', 'fuchsia', 'gray', 'green', 'lightgray', 'lime', 'magenta', 'maroon', 'navy', 'olive', 'orange', 'pink', 'purple', 'red', 'silver', 'teal', 'white', 'yellow'.

All color properties also accept a value of 'transparent'.

On Android, if you want to create a semi-transparent window, set the opacity property before opening the window.

On iOS, you can set a global tinting using Titanium.UI.tintColor. All child views will inherit the tint color by default and are able to override the color using tintColor on their own views. The default tintColor on iOS is the blue (system-color).

If a color property is undefined, the default color of the particular UI element is applied. If a color value is not valid on iOS, the default color is applied, whereas, on Android, the color yellow is applied.

On iOS, you may use named system colors. See the Titanium.UI.Color documentation for more details.

Dark Mode

In iOS 13 Apple introduced support for users to adopt a system-wide Dark Mode setting where the screens, view, menus, and controls use a darker color palette. You can read more about this in the Apple Human Interface Guidelines.

There are two aspects to dark mode that can be specified for your app, colors and images.

Specifying Dark Mode colors

To specify colors for dark mode, also known as semantic colors, first create a file called semantic.colors.json in the Resources directory for classic applications, or in the assets directory for Alloy applications. Then you can specify color names in the following format:

  {
    "textColor": { // the name for your color
      "dark": {
        "color": "#ff85e2", // hex color code to be set
        "alpha": "50" // can be set from a range of 0.0-100.0, integer or float
      },
      "light": "#ff1f1f" // can be a hex color (with alpha via ARGB/AARRGGBB)
    }
  }

To reference these colors in your application use the Titanium.UI.fetchSemanticColor API, this is a cross platform API that on iOS 13 and above will use the native method that checks the users system-wide setting, and in all other instances will check the Titanium.UI.semanticColorType property and return the correct color for the current setting.

You may also directly use the named of the colors as values to any color properties on UI elements.

Specifying Dark Mode images

Note: Dark Mode images are iOS only.

To specify dark mode images, use the -dark suffix on the image name. When building your app the images are set as the dark mode variant, then refer to images as normal and iOS will select the correct image dependent on the users system-wide setting.

For example given an image logo.png with @2x and @3x variants, the following dark mode images should exist:

  • logo-dark.png
  • logo-dark@2x.png
  • logo-dark@3x.png

And you would reference the image as before using logo-dark.png

Android: You can use the native app/assets/android/images/res-night folder (extend them with e.g. res-night-xxhdpi if needed) for dark-mode images.

Examples

Color Demo

The following example demonstrates all the color formats, and color names, that are intended to be supported by Titanium. See the description section for details.

var colorArray = [
  '#ff00ff', '#f0f', 'rgb(255,0,255)',
  'transparent', '#55ff00ff', '#5f0f', 'rgba(255,0,255,0.3)',
  'aqua', 'black', 'blue', 'brown', 'cyan', 'darkgray', 'fuchsia', 'gray', 'green',
  'lightgray', 'lime', 'magenta', 'maroon', 'navy', 'olive', 'orange', 'pink',
  'purple', 'red', 'silver', 'teal', 'white', 'yellow',
];
var win = Ti.UI.createWindow({
  backgroundColor: 'black',
  exitOnClose: true,
  fullscreen: false,
  layout: 'vertical',
  title: 'Color Demo'
});
var rows = [];
var row;
for (var i=0, ilen = colorArray.length; i < ilen; i++){
  row = Ti.UI.createTableViewRow({
    color:'black',
    backgroundColor: colorArray[i],
    title: colorArray[i],
    height: 40
  });
  rows.push(row);
}
var table = Ti.UI.createTableView({
  data: rows,
  backgroundColor: 'white'
});
win.add(table);
win.open();

Properties 285

ANIMATION_CURVE_EASE_IN_OUT

Numbersince Android 8.0.0, iPhone 0.9, iPad 0.9read-only

Use with Animation.curve to specify an animation that starts slowly, and speeds up, then slows down at the end of the animation.

ANIMATION_CURVE_EASE_OUT

Numbersince Android 8.0.0, iPhone 0.9, iPad 0.9read-only

Use with Animation.curve to specify an animation that starts quickly, then slows down at the end of the animation.

apiName

Stringsince Android 3.2.0, iPhone 3.2.0, iPad 3.2.0, macOS 9.2.0read-only

Inherited from Titanium.Proxy

The name of the API that this proxy corresponds to.

ATTRIBUTE_EXPANSION

NumberiPhoneiPadmacOSsince 3.6.0read-only

Use with Attribute.type to stretch the text horizontally.

Set Attribute.value to a float value to specify how much to stretch the text.

For iOS, the default value is 0.0 and has no minimum/maximum range specified. For Windows, the default value is 0.0 and the valid range is between 0.5 and 1.0.

See Attribute for more information.

ATTRIBUTE_KERN

NumberiPhoneiPadmacOSsince 3.6.0read-only

Use with Attribute.type to specify kerning (space between characters).

Set Attribute.value to a float value specifying how many pixels to increase the character spacing.

See Attribute for more information.

ATTRIBUTE_STROKE_COLOR

NumberiPhoneiPadmacOSsince 3.6.0read-only

Use with Attribute.type to specify a color for the stroke text.

Use a color name or hex value for the value property in the attributes dictionary.

See Attribute for more information on type modes.

ATTRIBUTE_STROKE_WIDTH

NumberiPhoneiPadmacOSsince 3.6.0read-only

Use with Attribute.type to specify the width of the stroke text.

Set Attribute.value to a float value specifying the size of stroke width as a percentage of the font size. A positive value displays an outline of the charater, while a negative value fills the character.

See Attribute for more information.

AUTOFILL_TYPE_EMAIL

Stringsince 6.3.0read-onlyAndroid 8.0+

Specifies the expectation of an email address.

AUTOFILL_TYPE_LOCATION

StringiPhoneiPadmacOSsince 6.3.0read-only

Specifies the expectation of a location, such as a point of interest, an address, or another way to identify a location.

AUTOFILL_TYPE_NAME

Stringsince 6.3.0read-onlyAndroid 8.0+

Specifies the expectation of a name.

AUTOFILL_TYPE_NAME_PREFIX

StringiPhoneiPadmacOSsince 6.3.0read-only

Specifies the expectation of a prefix or title, such as 'Dr.'

AUTOFILL_TYPE_PHONE

Stringsince 6.3.0read-onlyAndroid 8.0+

Specifies the expectation of a telephone number.

AUTOFILL_TYPE_URL

StringiPhoneiPadmacOSsince 6.3.0read-only

Specifies the expectation of a URL.

AUTOFILL_TYPE_USERNAME

Stringsince 6.3.0read-onlyAndroid 8.0+

Specifies the expectation of an account or login name.

Sets the background color of the master view (when there are no windows or other top-level controls displayed).

The default background color may also show through if you use semi-transparent windows.

Local path or URL to an image file for setting a background for the master view (when there are no windows or other top-level controls displayed).

The default background image may also show through if you use semi-transparent windows.

BREAK_BALANCED

NumberAndroidsince 12.3.0read-only

Line breaking strategy balances line lengths.

BREAK_HIGH_QUALITY

NumberAndroidsince 12.3.0read-only

Line breaking uses high-quality strategy, including hyphenation.

BREAK_SIMPLE

NumberAndroidsince 12.3.0read-only

Line breaking uses simple strategy.

bubbleParent

Booleansince Android 3.0.0, iPhone 3.0.0, iPad 3.0.0, macOS 9.2.0

Inherited from Titanium.Proxy

Indicates if the proxy will bubble an event to its parent.

Default: true

BUTTON_STYLE_OPTION_NEGATIVE

Numbersince 10.0.0read-only

Use with Button.style to show a negative themed escape button.

This is a text-only button without a background. It is intended to be used in conjunction with BUTTON_STYLE_OPTION_POSITIVE and BUTTON_STYLE_OPTION_NEUTRAL to show an escape button to exit a window or dialog such as "Cancel", "No", etc.

This is not supported on iOS and will use BUTTON_STYLE_TEXT instead.

On Android, this can be customized by the buttonBarNegativeButtonStyle attribute. By default, Android's built-in themes will style this button the same as BUTTON_STYLE_OPTION_NEUTRAL and BUTTON_STYLE_TEXT.

BUTTON_STYLE_OPTION_NEUTRAL

Numbersince 10.0.0read-only

Use with Button.style to show a normal themed option button.

This is a text-only button without a background. It is intended to be used in conjunction with BUTTON_STYLE_OPTION_POSITIVE and BUTTON_STYLE_OPTION_NEGATIVE to show a normal informational button.

This is not supported on iOS and will use BUTTON_STYLE_TEXT instead.

On Android, this can be customized by the buttonBarNeutralButtonStyle attribute. By default, Android's built-in themes will style this button the same as BUTTON_STYLE_OPTION_NEGATIVE and BUTTON_STYLE_TEXT.

BUTTON_STYLE_OPTION_POSITIVE

Numbersince 10.0.0read-only

Use with Button.style to show a positive themed accept button.

This is a text-only button without a background. It is intended to be used in conjunction with BUTTON_STYLE_OPTION_NEGATIVE and BUTTON_STYLE_OPTION_NEUTRAL to show an an accept button before closing a window or dialog such as "OK", "Yes", "Done", etc. It is typically colored differently than a BUTTON_STYLE_TEXT themed button on iOS.

On Android, this can be customized by the buttonBarPositiveButtonStyle attribute.

By default, the Android material theme does not style this button differently than any other text-only button. Only the holo theme will style it differently.

CLIPBOARD_OPTION_EXPIRATION_DATE

StringiPhoneiPadmacOSsince 5.5.0read-only

Specifies the time and date that you want the system to remove the clipboard items from the clipboard.

Note that on macOS, setting a date in the past does not appear to invalidate items immediately, while on iOS it does.

CLIPBOARD_OPTION_LOCAL_ONLY

StringiPhoneiPadmacOSsince 5.5.0read-only

Specifies that the clipboard items should not be available to other devices through Handoff.

cutoutSize

CutoutSizeAndroidsince 12.1.0read-only

Returns the position and shape of the Android notch. Read more about the notch here.

Using Android 9+ it will return the bounding box of the Android notch. It will return top,left, widthandheight`.

DATE_PICKER_STYLE_AUTOMATIC

Numbersince 10.0.1read-onlyiOS 13.4+

Displays a Titanium.UI.Picker using the best visual style on the current platform for date/time selection.

On Android and iOS, a picker with this style will be shown in compatct form, where the picker will be a read-only text field which opens a selection dialog when tapped on.

Note: Prior to iOS 14, this property is only used on iOS Catalyst apps.

DATE_PICKER_STYLE_COMPACT

Numbersince 10.0.1read-onlyiOS 13.4+

Displays a Titanium.UI.Picker as a read-only text field which opens a selection dialog when tapped on.

Note: Prior to iOS 14, this property is only used on iOS Catalyst apps.

DATE_PICKER_STYLE_INLINE

Numbersince 10.0.1read-onlyiOS 14.0+

Displays a Titanium.UI.Picker as a large calendar or clock view for date/time selection.

On iOS, an inlined "time" picker will appear as a text field with spinners for hours and minutes.

FILL

Stringsince 2.0.0read-only

FILL behavior for UI layout.

The FILL behavior means the view will grow its size to fill its parent.

HINT_TYPE_ANIMATED

NumberAndroidread-only

Use when creating a TextField to specify the hintType as animated.

HINT_TYPE_STATIC

NumberAndroidread-only

Use when creating a TextField to specify the hintType as static.

HYPHEN_FULL

NumberAndroidsince 12.3.0read-only

Standard amount of hyphenation, useful for running text and for screens with limited space for text.

HYPHEN_FULL_FAST

NumberAndroidsince 12.3.0read-only

Same to hyphenationFrequency="full" but using faster algorithm for measuring hyphenation break points.

HYPHEN_NONE

NumberAndroidsince 12.3.0read-only

No hyphenation.

HYPHEN_NORMAL

NumberAndroidsince 12.3.0read-only

Less frequent hyphenation, useful for informal use cases, such as chat messages.

HYPHEN_NORMAL_FAST

NumberAndroidsince 12.3.0read-only

Same to hyphenationFrequency="normal" but using faster algorithm for measuring hyphenation break points.

KEYBOARD_TYPE_ASCII

Numbersince 5.2.0read-only

Use a keyboard supporting all characters except emoji. Defaults to English letters layout on iOS.

This keyboard type allows the end-user to enter numbers, symbols, and non-English letters too. It just launches with the English letters keyboard layout when shown. This type will not allow the end-user to display an emoji keyboard.

Android keyboards will typically ignore this setting and show the default language keyboard instead, but will still not allow the end-user to enter emoji characters like iOS.

Use with the Titanium.UI.TextField.keyboardType and Titanium.UI.TextArea.keyboardType properties.

KEYBOARD_TYPE_NUMBERS_PUNCTUATION

Numbersince 5.2.0read-only

Use a keyboard supporting all characters except emoji, defaulting to numbers layout on iOS.

On iOS, this will default to showing the "Numbers and Punctuation" side of the keyboard, but still allows the end-user to switch to other keyboards for entering letters as well. This type will not allow the end-user to display an emoji keyboard.

On Android, this type displays a normal keyboard defaulting to the letter side, but will not allow the end-user to enter emoji characters like iOS.

Use with the Titanium.UI.TextField.keyboardType and Titanium.UI.TextArea.keyboardType properties.

LIST_ACCESSORY_TYPE_CHECKMARK

Numbersince 3.1.0read-only

Displays a checkmark on the right side of an item in a list view.

Use to indicate an item in a list is selected.

LIST_ACCESSORY_TYPE_DETAIL

Numbersince 3.1.0read-only

Displays a detail disclosure button on the right side of an item in a list view.

Use to indicate that selecting this item results in the display of a detailed view of that item.

LIST_ACCESSORY_TYPE_DISCLOSURE

Numbersince 3.1.0read-only

Displays a disclosure indicator on the right side of an item in a list view.

Use to indicate that selecting this item results in the display of another list, reflecting the next level in the data model hierarchy.

LIST_ITEM_TEMPLATE_CONTACTS

NumberiPhoneiPadmacOSsince 3.1.0read-only

A built-in style for an item with a right-aligned title label on the left side of the cell, which is next to a left-aligned subtitle label.

The title label value and subtitle label value bind to the title and subtitle properties, respectively, of the data item. If a property is not set, that element is not displayed.

LIST_ITEM_TEMPLATE_DEFAULT

Numbersince 3.1.0read-only

A built-in style for an item with an image view and left-aligned title label.

The text label value and image value bind to the title and image properties, respectively, of the data item. If a property is not set, that element is not displayed.

On Android, the image appears on the right side of the cell, and on iOS, the image appears on the left side of the cell.

LIST_ITEM_TEMPLATE_SETTINGS

NumberiPhoneiPadmacOSsince 3.1.0read-only

A built-in style for a item with an image view; a left-aligned title label; and a right-aligned subtitle label.

The title label value, subtitle label value and image value bind to the title, subtitle and image properties, respectively, of the data item. If a property is not set, that element is not displayed.

LIST_ITEM_TEMPLATE_SUBTITLE

NumberiPhoneiPadmacOSsince 3.1.0read-only

A built-in style for an item with an image view; a black, left-aligned title label across the top of the cell and a subtitle label below it.

The title label value, subtitle label value and image value bind to the title, subtitle and image properties, respectively, of the data item. If a property is not set, that element is not displayed.

overrideUserInterfaceStyle

Numbersince 10.0.1iOS 13.0+

Forces the app to used assigned theme instead of the system theme.

When set to USER_INTERFACE_STYLE_DARK or USER_INTERFACE_STYLE_LIGHT, the app will ignore the system's current theme and use the theme assigned to this property instead.

When set to USER_INTERFACE_STYLE_UNSPECIFIED, the app will use the system's current theme. To determine what the system's current theme is, you must read the userInterfaceStyle property.

See UI_MODE_NIGHT_MASK.

Default: Titanium.UI.USER_INTERFACE_STYLE_UNSPECIFIED

PICKER_TYPE_COUNT_DOWN_TIMER

NumberiPhoneiPadmacOSread-only

Use a picker with a countdown timer appearance, showing hours and minutes.

For an actual countdown timer, the application is responsible for setting a timer to update the picker values.

PICKER_TYPE_PLAIN

Numberread-only

Use a plain picker (for values other than date or time).

SELECTION_STYLE_DEFAULT

Numbersince 10.1.0read-only

Set the selection style to system default.

Use with the <Titanium.UI.ListView.selectionStyle> and <Titanium.UI.TableView.selectionStyle> properties.

SELECTION_STYLE_NONE

Numbersince 10.1.0read-only

Set the selection style to none.

Use with the <Titanium.UI.ListView.selectionStyle> and <Titanium.UI.TableView.selectionStyle> properties.

SIZE

Stringsince 2.0.0read-only

SIZE behavior for UI layout.

The SIZE behavior means the view will constrain its size fit its contents.

statusBarHeight

Numbersince 12.1.0read-only

The total height of the status bar including safe area padding.

Use this property to determine an absolute spacing to the top in full screen windows. Note: For a more flexible approach, e.g. when allowing rotation, we recommend using the Titanium.UI.Window.safeAreaPadding property of the related window.

TEXT_STYLE_BODY

StringiPhoneiPadmacOSsince 3.2.0read-only

The font used for body texts.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_CALLOUT

StringiPhoneiPadmacOSsince 6.0.0read-only

The font used for callouts.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_CAPTION1

StringiPhoneiPadmacOSsince 3.2.0read-only

The font used for standard captions.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_CAPTION2

StringiPhoneiPadmacOSsince 3.2.0read-only

The font used for alternate captions.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_FOOTNOTE

StringiPhoneiPadmacOSsince 3.2.0read-only

The font used in footnotes.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_HEADLINE

StringiPhoneiPadmacOSsince 3.2.0read-only

The font used for headings.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_LARGE_TITLE

StringiPhoneiPadmacOSsince 8.1.0read-only

Specifies the text style for the Font Object.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_SUBHEADLINE

StringiPhoneiPadmacOSsince 3.2.0read-only

The font used for subheadings.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_TITLE1

StringiPhoneiPadmacOSsince 6.0.0read-only

The font used for first level hierarchical headings.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_TITLE2

StringiPhoneiPadmacOSsince 6.0.0read-only

The font used for second level hierarchical headings.

One of the group of textStyle constants for the Font Object.

TEXT_STYLE_TITLE3

StringiPhoneiPadmacOSsince 6.0.0read-only

The font used for third level hierarchical headings.

One of the group of textStyle constants for the Font Object.

tintColor

String | Titanium.UI.ColoriPhoneiPadmacOSsince 6.0.0

Sets the global tint color of the application. It is inherited by the child views and can be overwritten by them using the tintColor property.

UNIT_CM

Stringsince 2.0.0read-only

Unit constant representing units in centimeters.

UNIT_DIP

Stringsince 2.0.0read-only

Unit constant representing units in density-independent pixels.

UNIT_IN

Stringsince 2.0.0read-only

Unit constant representing units in inches.

UNIT_MM

Stringsince 2.0.0read-only

Unit constant representing units in millimeters.

UNIT_PX

Stringsince 2.0.0read-only

Unit constant representing units in pixels.

Methods 51

Inherited from Titanium.Proxy

Adds the specified callback as an event listener for the named event.

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to invoke when the event is fired.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

convertUnits

since 2.0.0

Converts one type of unit to another using the metrics of the main display.

As this method does not support percentages, 0 is returned if they are specified.

Parameters
ParametersTypeDescription
convertFromValueString

Measurement and optional unit to convert from, i.e. 160, "120dip". Percentages are not accepted.

convertToUnitsNumber

Desired unit for the conversion result.

Returns Number

Creates and returns an instance of Titanium.UI.Matrix3D.

Parameters
ParametersTypeDescription
parameters?Matrix3DCreationDict

Initial transformation of the matrix.

1 field
scale? Number

Scale the matrix by the specified scaling factor.

Fetches the correct color to be used with a UI element dependent on the users current dark mode setting on iOS 13 and above, or the Titanium.UI.semanticColorType setting in other instances. Will return a valid string value to be used for color properties on Android. This may be a hex string or an rgba() function.

Parameters
ParametersTypeDescription
colorNameString

Name of the semantic color defined in the applications colorset.

Inherited from Titanium.Proxy

Fires a synthesized event to any registered listeners.

Parameters
ParametersTypeDescription
nameString

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
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to remove. Must be the same function passed to addEventListener.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

Events 1

Fired when the userInterfaceStyle changes.

Event properties
Event propertiesTypeDescription
valueNumber

The new userInterfaceStyle value.