You are reading 13.2.0. See this page in 13.4.1.
Titanium.UI.Button
Extends Titanium.UI.ViewTitanium.Proxy
A button widget that has four states: normal, disabled, focused and selected.
| Android | iOS |
|---|---|
![]() |
![]() |
A button displays its selected state while it is being pressed. The focused state is only used on Android devices that have navigation keys or a keyboard, to indicate which button has input focus.
You can specify background images for each state, as well as button text and a button icon. On iOS, there are button styles which define appearance for each state, even if no button images are set.
Use the Titanium.UI.createButton method or a <Button> Alloy element to create a button
(see Examples) .
Android Platform Notes
Android uses default button images for the normal, focused, selected and disabled states. If you use a custom button image, you should specify versions for the focused and selected states (and the disabled state, if the button is ever disabled).
Android also supports setting the background color for each of the states. These are not supported on iOS.
The Material style introduced in Titanium SDK 10.0.0 will change the default look of the buttons. You can change button styles with a custom theme as follows:
<!-- Assign this custom theme to "tiapp.xml" file's Android manifest application element. -->
<style name="Theme.MyTheme" parent="Theme.Titanium.Light">
<item name="textAppearanceButton">@style/TextAppearance.MyButton</item>
<item name="android:buttonStyle">@style/Widget.MyButton</item>
<item name="buttonStyle">@style/Widget.MyButton</item>
</style>
<!-- Affects the appearance of text in all material buttons. -->
<style name="TextAppearance.MyButton" parent="TextAppearance.MaterialComponents.Button">
<!-- Do not display button text in all-caps. -->
<item name="android:textAllCaps">false</item>
<!-- Remove extra spacing between characters. -->
<item name="android:letterSpacing">0</item>
</style>
<!-- Affects the appearance of all non-material system buttons. -->
<style name="Widget.MyButton" parent="Widget.AppCompat.Button">
<!-- Do not display button text in all-caps. -->
<item name="android:textAllCaps">false</item>
<!-- Remove extra spacing between characters. -->
<item name="android:letterSpacing">0</item>
</style>
iOS Platform Notes
- When assigning a custom image to the
backgroundImageproperty, the image must be partially or wholly transparent for the background color or background gradient to be visible. - Similarly, for an assigned background gradient to show through, the
backgroundColormay need to be set to 'transparent'.
Unlike Android, iOS doesn't supply any default background images for buttons-- system button styles serve this purpose.
The systemButton property lets you create a predefined system-defined button,
such as the Camera or Add buttons, for use in toolbars and nav bars.
Specifically, system buttons may be used in the following locations:
- Titanium.UI.iOS.Toolbar. The
itemsarray can contain system buttons. - Titanium.UI.iPad.Popover. The
leftNavButtonandrightNavButtonproperties can refer to system buttons - Titanium.UI.iOS.SplitWindow. The
toolbararray can contain system buttons. - Titanium.UI.TextField. The
keyboardToolbararray can contain system buttons. - Titanium.UI.TextArea. The
keyboardToolbararray can contain system buttons. - Titanium.UI.Window. The
leftNavButtonandrightNavButtonproperties can refer to system buttons and thetoolbararray can contain system buttons.
Use the constants in Titanium.UI.iOS.SystemButton
to specify a button type. The size, style and decoration of system buttons is set
automatically, so you can create a button by setting only the systemButton property.
For example:
var cancelButton = Ti.UI.createButton({ systemButton: Ti.UI.iOS.SystemButton.CANCEL });
In Alloy, you can omit the namespace when setting the systemButton property:
<Button id="cancelbtn" systemButton="CANCEL"></Button>
Note that the systemButton property specifies appearance, not behavior. For
example, to bring up the camera when the user presses the Camera button, you must
add an event listener to the button and call Titanium.Media.showCamera when the
button is clicked.
iOS Pressed Button Effects
If you do not supply separate background images for the normal and selected states, iOS supplies a built-in effect for pressed buttons. For most iOS buttons, the effect dims the entire button (except for the text) while the button is being pressed.
For toolbar buttons that use the PLAIN style or use system icons such as CAMERA, a glow effect is used. The glow effect shows as a white circular glow or highlight at the center of the button when the button is pressed.
Examples
Simple Button Example
var win = Ti.UI.createWindow();
var button = Titanium.UI.createButton({
title: 'Hello',
top: 10,
width: 100,
height: 50
});
button.addEventListener('click',function(e)
{
Titanium.API.info("You clicked the button");
});
win.add(button);
win.open();
Alloy XML Markup
Previous example as an Alloy view.
button.xml:
<Alloy>
<Window id="win" backgroundColor="white">
<!-- The title property can also be defined as node text. -->
<Button id="button" onClick="doClick" title="Hello"
top="10" width="100" height="50" />
</Window>
</Alloy>
button.js:
function doClick(e){
Titanium.API.info("You clicked the button");
};
Properties 89
Inherited from Titanium.UI.View
Boolean value to remove the long press notification for the device's accessibility service.
Default: true
Inherited from Titanium.UI.View
Whether the view should be "hidden" from (i.e., ignored by) the accessibility service.
Default: false
Inherited from Titanium.UI.View
Briefly describes what performing an action (such as a click) on the view will do.
Default: null
Inherited from Titanium.UI.View
A succinct label identifying the view for the device's accessibility service.
Inherited from Titanium.UI.View
A string describing the value (if any) of the view for the device's accessibility service.
Inherited from Titanium.UI.View
Coordinate of the view about which to pivot an animation.
Inherited from Titanium.UI.View
Current position of the view during an animation.
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Specify an attributed string for the label.
The underlying attributed string drawn by the label. If set, avoid setting common attributes
in the label, such as color and font, as unexpected behaviors may result.
iOS note: This property can also be used to suppress the underline style when accessibility
is enabled. To do so, set the type to Titanium.UI.ATTRIBUTE_UNDERLINES_STYLE and the
value to Titanium.UI.ATTRIBUTE_UNDERLINE_STYLE_NONE.
backgroundColor
String | Titanium.UI.ColorInherited from Titanium.UI.View
Background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Disabled background color of the view, as a color name or hex triplet.
backgroundDisabledImage
StringBackground image for the button in its disabled state, specified as a local file path or URL.
Also sets the background image for the other button states (normal, focused, selected), unless they've been specified explicitly, except for iOS, which requires a backgroundImage.
Inherited from Titanium.UI.View
Focused background color of the view, as a color name or hex triplet.
backgroundFocusedImage
StringBackground image for the button in its focused state, specified as a local file path or URL.
Focusable must be true for normal views. Sets the background image for the focused state only. For iOS, since there is not a trackball, this does nothing.
Inherited from Titanium.UI.View
A background gradient for the view.
Linear and Radial Gradients
The following code excerpt creates two views, one with a linear gradient and one with a radial gradient.
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
layout: 'vertical'
});
var radialGradient = Ti.UI.createView({
top: 10,
width: 100,
height: 100,
backgroundGradient: {
type: 'radial',
startPoint: { x: 50, y: 50 },
endPoint: { x: 50, y: 50 },
colors: [ 'red', 'blue'],
startRadius: 50,
endRadius: 0,
backfillStart: true
}
});
var linearGradient = Ti.UI.createView({
top: 10,
width: 100,
height: 100,
backgroundGradient: {
type: 'linear',
startPoint: { x: '0%', y: '50%' },
endPoint: { x: '100%', y: '50%' },
colors: [ { color: 'red', offset: 0.0}, { color: 'blue', offset: 0.25 }, { color: 'red', offset: 1.0 } ],
}
});
win1.add(radialGradient);
win1.add(linearGradient);
win1.open();
backgroundImage
StringBackground image for the button in its normal state, specified as a local file path or URL.
Also sets the background image for the other button states (disabled, focused, selected),
unless they've been specified explicitly. On iOS, if backgroundDisabledImage is unset, the
image will appear faded to indicate being disabled. Also on iOS, if backgroundSelectedImage
is unset, the image will be darkened to indicate being selected.
Inherited from Titanium.UI.View
Size of the left end cap.
Default: 0
backgroundRepeat
BooleanInherited from Titanium.UI.View
Determines whether to tile a background across a view.
Default: false
Selected background color of the view, as a color name or hex triplet.
For information about color values, see the "Colors" section of Titanium.UI.
Default: Background color of this view.
backgroundSelectedImage
StringBackground image for the button in its selected state, specified as a local file path or URL.
On Android, Focusable must be true in order to be selected. Sets the background image for the selected state only.
Inherited from Titanium.UI.View
Size of the top end cap.
Default: 0
borderColor
String | Titanium.UI.ColorInherited from Titanium.UI.View
Border color of the view, as a color name or hex triplet.
borderRadius
Number | String | Array<Number> | Array<String>Inherited from Titanium.UI.View
Radius for the rounded corners of the view's border.
Default: 0
borderWidth
NumberInherited from Titanium.UI.View
Border width of the view.
Default: 0
bottom
Number | StringInherited from Titanium.UI.View
View's bottom position, in platform-specific units.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
Inherited from Titanium.UI.View
View's center position, in the parent view's coordinates.
Inherited from Titanium.UI.View
View's clipping behavior.
color
String | Titanium.UI.ColorDefault button text color, as a color name or hex triplet.
For information about color values, see the "Colors" section of Titanium.UI.
Button configuration for modern button styling.
A Titanium.UI.iOS.ButtonConfiguration object that defines the appearance and behavior of the button. This provides a modern way to configure buttons with support for titles, subtitles, images, and various styling options. Right now, the configuration is immutable, so you cannot change individual properties. Instead, update the whole configuration.
When using a button configuration, it takes precedence over individual styling properties
like title, color, and backgroundColor.
Note: Since Titanium SDK 13.1.0, you can also pass an key-value Object directly, which is internally converted to a button configuration.
Text color of the button in its disabled state, as a color name or hex triplet.
Inherited from Titanium.UI.View
Base elevation of the view relative to its parent in pixels.
Set to true to enable the button, false to disable the button.
Default: true
Inherited from Titanium.UI.View
Discards touch related events if another app's system overlay covers the view.
Default: false
Inherited from Titanium.UI.View
Whether view should be focusable while navigating with the trackball.
Default: false
Font to use for the button text.
height
Number | StringInherited from Titanium.UI.View
View height, in platform-specific units.
Inherited from Titanium.UI.View
Adds a horizontal parallax effect to the view
Inherited from Titanium.UI.View
Determines whether the layout has wrapping behavior.
Default: true
id
StringInherited from Titanium.UI.View
View's identifier.
image
String | Number | Titanium.BlobImage to display next to the button title.
As of Titanium 11.0.0, the imageIsMask property determines how
this image is displayed. If set true, this image will be tinted using the color assigned to the
tintColor property. If set false, the image is displayed as-is.
On Android, you can set this to a numeric resource drawable ID via Ti.App.Android.R.drawable.*
which lets you use native vector drawables that are commonly used as icons.
Set true to tint the button image. Set false to show the image as-is.
Default: true
Inherited from Titanium.UI.View
A value indicating the render mode of the View
Default: false
Inherited from Titanium.UI.View
Determines whether to keep the device screen on.
Default: false
layout
StringInherited from Titanium.UI.View
Specifies how the view positions its children. One of: 'composite', 'vertical', or 'horizontal'.
left
Number | StringInherited from Titanium.UI.View
View's left position, in platform-specific units.
Inherited from Titanium.Proxy
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
opacity
NumberInherited from Titanium.UI.View
Opacity of this view, from 0.0 (transparent) to 1.0 (opaque). Defaults to 1.0 (opaque).
Inherited from Titanium.UI.View
When on, animate call overrides current animation if applicable.
Inherited from Titanium.UI.View
The preview context used in the 3D-Touch feature "Peek and Pop".
Inherited from Titanium.UI.View
Background color of the wrapper view when this view is used as either Titanium.UI.ListView.pullView or Titanium.UI.TableView.headerPullView.
Defaults to undefined. Results in a light grey background color on the wrapper view.
Inherited from Titanium.UI.View
The bounding box of the view relative to its parent, in system units.
right
Number | StringInherited from Titanium.UI.View
View's right position, in platform-specific units.
Inherited from Titanium.UI.View
Clockwise 2D rotation of the view in degrees.
Inherited from Titanium.UI.View
Clockwise rotation of the view in degrees (x-axis).
Inherited from Titanium.UI.View
Clockwise rotation of the view in degrees (y-axis).
Inherited from Titanium.UI.View
Scaling of the view in x-axis in pixels.
Inherited from Titanium.UI.View
Scaling of the view in y-axis in pixels.
Button text color used to indicate the selected state, as a color name or hex triplet.
For information about color values, see the "Colors" section of Titanium.UI.
Shadow color of the title, as a color name or hex triplet.
Use in conjunction with shadowOffset and shadowRadius. For information about color values, see the "Colors" section of Titanium.UI.
Shadow offset of the title, as a dictionary with the properties x and y.
Use in conjunction with shadowColor and shadowRadius.
Shadow radius of the title.
Use in conjunction with shadowColor and shadowOffset.
Inherited from Titanium.UI.View
The size of the view in system units.
Inherited from Titanium.UI.View
Determines keyboard behavior when this view is focused. Defaults to Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS.
The border and fill style the button will use.
On Android, this is a creation-only property and cannot be changed dynamically.
Default: <Titanium.UI.BUTTON_STYLE_TEXT> (on iOS),
<Titanium.UI.BUTTON_STYLE_FILLED> (on Android)
Specifies an iOS system button appearance, as defined in Titanium.UI.iOS.SystemButton.
In JavaScript:
var cancelButton = Ti.UI.createButton({
systemButton: Ti.UI.iOS.SystemButton.CANCEL
});
In Alloy, you can omit the namespace when setting the systemButton property on a <Button>
element:
<Button systemButton="CAMERA"/>
textAlign
String | NumberText alignment, specified using one of the Titanium.UI text alignment constants.
Default: <Titanium.UI.TEXT_ALIGNMENT_CENTER>
Color applied to button's image and title.
Color to be applied to the button's image, but only if the
imageIsMask property is set true.
This tint color is also applied to the button's title unless the color property is set.
title
StringButton title.
Key identifying a string from the locale file to use for the button title.
Only one of title or titleid should be specified.
The default text to display in the control's tooltip.
Assigning a value to this property causes the tool tip to be displayed for the view.
Setting the property to null cancels the display of the tool tip for the view.
Note: This property is only used for apps targeting macOS Catalyst.
top
Number | StringInherited from Titanium.UI.View
The view's top position.
touchEnabled
BooleanInherited from Titanium.UI.View
Determines whether view should receive touch events.
Default: true
Inherited from Titanium.UI.View
A material design visual construct that provides an instantaneous visual confirmation of touch point.
Default: false
Inherited from Titanium.UI.View
Optional touch feedback ripple color. This has no effect unless touchFeedback is true.
Inherited from Titanium.UI.View
Transformation matrix to apply to the view.
Default: Identity matrix
Inherited from Titanium.UI.View
A name to identify this view in activity transition.
Inherited from Titanium.UI.View
Horizontal location of the view relative to its left position in pixels.
Inherited from Titanium.UI.View
Vertical location of the view relative to its top position in pixels.
Inherited from Titanium.UI.View
Depth of the view relative to its elevation in pixels.
verticalAlign
Number | StringVertical alignment for the text field, specified using one of the vertical alignment constants from Titanium.UI.
Default: Titanium.UI.TEXT_VERTICAL_ALIGNMENT_CENTER
Inherited from Titanium.UI.View
Adds a vertical parallax effect to the view
viewShadowColor
String | Titanium.UI.Colorsince Android 11.1.0, iPhone 3.3.0, iPad 3.3.0, macOS 9.2.0Inherited from Titanium.UI.View
Determines the color of the shadow.
Inherited from Titanium.UI.View
Determines the offset for the shadow of the view.
Inherited from Titanium.UI.View
Determines the blur radius used to create the shadow.
visible
BooleanInherited from Titanium.UI.View
Determines whether the view is visible.
Default: true
width
Number | StringInherited from Titanium.UI.View
View's width, in platform-specific units.
zIndex
NumberInherited from Titanium.UI.View
Z-index stack order position, relative to other sibling views.
Methods 13
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
|
Inherited from Titanium.UI.View
Animates this view.
| Parameters | Type | Description |
|---|---|---|
| animation | Titanium.UI.Animation | Dictionary<Titanium.UI.Animation> | Either a dictionary of animation properties or an Animation object. |
| callback? | Callback<Object> | Function to be invoked upon completion of the animation. |
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.UI.View
Removes all previously added motion effects.
convertPointToView
since Android 1.8, iPhone 1.8, iPad 1.8, macOS 9.2.0Inherited from Titanium.UI.View
Translates a point from this view's coordinate system to another view's coordinate system.
| Parameters | Type | Description |
|---|---|---|
| point | Point | A point in this view's coordinate system. If this argument is missing an |
| destinationView | Titanium.UI.View | View that specifies the destination coordinate system to convert to. If this argument is not a view, an exception will be raised. |
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. |
getViewById
since 6.1.0Inherited from Titanium.UI.View
Returns the matching view of a given view ID.
| Parameters | Type | Description |
|---|---|---|
| id | String | The ID of the view that should be returned. Use the |
Inherited from Titanium.UI.View
Hides this view.
| Parameters | Type | Description |
|---|---|---|
| options? | AnimatedOptions | Animation options for Android only. Since SDK 5.1.0 and used only on Android 5.0+ Determines whether to enable a circular reveal animation.
Note that the default here is equivalent to passing in |
insertAt
since 3.3.0Inherited from Titanium.UI.View
Inserts a view at the specified position in the children array.
| Parameters | Type | Description |
|---|---|---|
| params | ViewPositionOptions | Pass an object that specifies the view to insert and optionally at which position (defaults to end) 2 fields
|
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
|
Inherited from Titanium.UI.View
Makes this view visible.
| Parameters | Type | Description |
|---|---|---|
| options? | AnimatedOptions | Animation options for Android only. Since SDK 5.1.0 and only used on Android 5.0+ Determines whether to enable a circular reveal animation.
Note that the default here is equivalent to passing in |
Inherited from Titanium.UI.View
Stops a running animation.
Inherited from Titanium.UI.View
Returns an image of the rendered view, as a Blob.
| Parameters | Type | Description |
|---|---|---|
| callback? | Callback<Titanium.Blob> | Function to be invoked upon completion. If non-null, this method will be performed asynchronously. If null, it will be performed immediately. |
| honorScaleFactor? | Boolean | Determines whether the image is scaled based on scale factor of main screen. (iOS only) When set to true, image is scale factor is honored. When set to false, the image in the blob has the same dimensions for retina and non-retina devices. |
Events 18
Inherited from Titanium.UI.View
Fired when the device detects a click against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when the device detects a double click against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when the device detects a double tap against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
focus
AndroidInherited from Titanium.UI.View
Fired when the view element gains focus.
keypressed
since Android 3.1.0, iPhone 5.4.0, iPad 5.4.0, macOS 9.2.0Inherited from Titanium.UI.View
Fired when a hardware key is pressed in the view.
| Event properties | Type | Description |
|---|---|---|
| keyCode | Number | The code for the physical key that was pressed. For more details, see KeyEvent. This API is experimental and subject to change. |
longclick
AndroidInherited from Titanium.UI.View
Fired when the device detects a long click.
Inherited from Titanium.UI.View
Fired when the device detects a long press.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
pinch
since 1.8.0Inherited from Titanium.UI.View
Fired when the device detects a pinch gesture.
| Event properties | Type | Description |
|---|---|---|
| scale | Number | The scale factor relative to the points of the two touches in screen coordinates. |
| velocity | Number | The velocity of the pinch in scale factor per second. |
| time | Number | The event time of the current event being processed. |
| timeDelta | Number | The time difference in milliseconds between the previous accepted scaling event and the current scaling event. |
| currentSpan | Number | The average distance between each of the pointers forming the gesture in progress through the focal point. |
| currentSpanX | Number | The average X distance between each of the pointers forming the gesture in progress through the focal point. |
| currentSpanY | Number | The average Y distance between each of the pointers forming the gesture in progress through the focal point. |
| previousSpan | Number | The previous average distance between each of the pointers forming the gesture in progress through the focal point. |
| previousSpanX | Number | The previous average X distance between each of the pointers forming the gesture in progress through the focal point. |
| previousSpanY | Number | The previous average Y distance between each of the pointers forming the gesture in progress through the focal point. |
| focusX | Number | The X coordinate of the current gesture's focal point. |
| focusY | Number | The Y coordinate of the current gesture's focal point. |
| inProgress | Boolean | Returns |
postlayout
since 2.0.0Inherited from Titanium.UI.View
Fired when a layout cycle is finished.
rotate
since 12.7.0Inherited from Titanium.UI.View
Fired when the device detects a two finger rotation.
| Event properties | Type | Description |
|---|---|---|
| rotate | Number | Rotation in degrees. |
Inherited from Titanium.UI.View
Fired when the device detects a single tap against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when the device detects a swipe gesture against the view.
| Event properties | Type | Description |
|---|---|---|
| direction | String | Direction of the swipe--either 'left', 'right', 'up', or 'down'. |
| x | Number | X coordinate of the event's endpoint from the |
| y | Number | Y coordinate of the event's endpoint from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when a touch event is interrupted by the device.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when a touch event is completed.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Penciland are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Fired when the device detects a swipe gesture against the view.
If the button's filterTouchesWhenObscured property
is set true, then this event will be fired if the touch event was discarded because another app's
overlapping window obscured it.
This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay.
You can use this event to display an alert dialog explaining why the button's action has been disabled. Especially if the overlapping window is completely invisible.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Always |
Inherited from Titanium.UI.View
Fired as soon as the device detects movement of a touch.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired as soon as the device detects a touch gesture.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
twofingertap
since 3.0.0Inherited from Titanium.UI.View
Fired when the device detects a two-finger tap against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |

