Skip to content
Titanium SDK
Version13.0.1

You are reading 13.0.1. See this page in 13.4.1.

Titanium.UI.TextField

viewAndroidiPhoneiPadmacOSsince 0.8

Extends Titanium.UI.ViewTitanium.Proxy

A single line text field.

Android iOS
Android iOS

Use the Titanium.UI.createTextField method or <TextField> Alloy element to create a text field.

click event in iOS

In iOS 11+, click event in text field is not fired due to changes from apple. Use touchstart event instead of click event.

Examples

Basic Text Field

Create a simple text field with green text color.

var win = Ti.UI.createWindow();

var textField = Ti.UI.createTextField({
  backgroundColor: '#fafafa',
  color: 'green',
  width: 250,
  height: 40
});

win.add(textField);
win.open();

Custom Keyboard Toolbar (iOS)

On iOS, a configurable toolbar can be displayed above the virtual keyboard. Toolbars can be used with both text areas and text fields. See <Titanium.UI.Toolbar> for more information.

This code excerpt creates a text field with a toolbar:

var win = Ti.UI.createWindow();

var send = Ti.UI.createButton({
    title: 'Send',
    style: Ti.UI.BUTTON_STYLE_OPTION_POSITIVE,
});

var camera = Ti.UI.createButton({
    systemButton: Ti.UI.iOS.SystemButton.CAMERA,
});

var cancel = Ti.UI.createButton({
    systemButton: Ti.UI.iOS.SystemButton.CANCEL
});

var flexSpace = Ti.UI.createButton({
    systemButton: Ti.UI.iOS.SystemButton.FLEXIBLE_SPACE
});

var textfield = Ti.UI.createTextField({
    borderStyle: Ti.UI.INPUT_BORDERSTYLE_BEZEL,
    hintText: 'Focus to see keyboard with toolbar',
    keyboardToolbar : [cancel, flexSpace, camera, flexSpace, send],
    keyboardToolbarColor: '#999',
    keyboardToolbarHeight: 40,
    top: 10,
    width: 300,
    height: 35
});

win.add(textField);
win.open();

Alloy XML Markup

Previous basic text field with green text color example using Alloy.

Alternatively, define the properties using the TSS file.

<Alloy>
    <Window id="win" backgroundColor="white">
        <TextField class="myTextField" color="green" width="250" height="45" />
    </Window>
</Alloy>

Alloy Custom Keyboard Toolbar (iOS)

Previous custom keyboard toolbar example as an Alloy view. Use the <KeyboardToolbar> XML element to set the keyboardToolbar property.

You can also declare the leftButton and rightButton properties in XML markup as the <LeftButton> and <RightButton> XML elements.

<Alloy>
    <Window fullscreen="true" backgroundColor="white">
        <TextField
            platform="ios"
            borderStyle="Ti.UI.INPUT_BORDERSTYLE_BEZEL"
            keyboardToolbarColor="#999"
            keyboardToolbarHeight="40"
            top="10"
            height="35"
            width="300"
            value="Focus to see keyboard with toolbar">

            <!-- Sets the keyboardToolbar property -->
            <KeyboardToolbar>
                <Toolbar>
                    <Items>
                        <Button systemButton="CANCEL" />
                        <FlexSpace/>
                        <Button systemButton="CAMERA" />
                        <FlexSpace/>
                        <Button style="DONE">Send</Button>
                    </Items>
                </Toolbar>
            </KeyboardToolbar>
        </TextField>
    </Window>
</Alloy>

Properties 115

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.

attributedHintText

Titanium.UI.AttributedStringsince Android 3.6.0, iPhone 3.2.0, iPad 3.2.0

Hint text attributed string.

The attributed hint text by the textField. If set, avoid setting common attributes in textField, such as hintText, color and font, as unexpected behaviors may result.

This has no effect when used with hintType Ti.UI.HINT_TYPE_ANIMATED.

Prior to Release 3.6.0, assign this property an object from the <Titanium.UI.iOS.AttributedString> class.

Since Appcelerator CLI 4.1.0 (Alloy 1.7.0), for Alloy, you can use an <AttributedHintText> element inside a <TextField> element and set the text property as node text:

<Alloy>
  <Window>
      <TextField>
        <AttributedHintText>
            Alloy is great!
        </AttributedHintText>
      </TextField>
  </Window>
</Alloy>

Then set attributes in the TSS file:

"AttributedString" : {
  attributes: [
    {
      type: Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,
      value: 'red',
      range: [0, 5]
    },
    {
      type: Ti.UI.ATTRIBUTE_UNDERLINES_STYLE,
      value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_SINGLE,
      range: [9, 5]
    }
  ]
}

attributedString

Titanium.UI.AttributedStringsince Android 3.6.0, iPhone 3.2.0, iPad 3.2.0

TextField attributed string.

The underlying attributed string drawn by the textField. If set, avoid setting common attributes in TextField, such as value, color and font, as unexpected behaviors may result.

For Alloy, you can use an <AttributedString> element inside a <TextField> element and set the text property as node text:

<Alloy>
  <Window>
      <TextField>
        <AttributedString>
            Alloy is great!
        </AttributedString>
      </TextField>
  </Window>
</Alloy>

Then set attributes in the TSS file:

"AttributedString" : {
  attributes: [
    {
      type: Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,
      value: 'red',
      range: [0, 5]
    },
    {
      type: Ti.UI.ATTRIBUTE_UNDERLINES_STYLE,
      value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_SINGLE,
      range: [9, 5]
    }
  ]
}

Determines whether to automatically correct text entered into this text field.

Set to true to enable automatic spelling correction. On iOS 9+, this can be used to disable QuickType suggestions.

If this property is not explicitly defined, it behaves as though it were set to true.

On iOS, the returned default value is false, and on Android, the returned default value is undefined, but all behave as if the value is true.

autofillType

Stringsince 6.3.0Android 8.0+

Sets the autofill type for the text field.

This sets the hint or content type to aid the autofill feature of iOS and Android to function.

Accepts 32 constants

Default: undefined

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();

borderRadius

Number | String | Array<Number> | Array<String>

Inherited from Titanium.UI.View

Radius for the rounded corners of the view's border.

Default: 0

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

Determines whether the value of this text field should be cleared when it is focused.

Default: false

Color of the text in this text field, as a color name or hex triplet.

For information about color values, see the "Colors" section of Titanium.UI.

editable

Boolean

Determines whether this field can be edited.

Default: true

elevation

NumberAndroidsince 5.0.0Android 5+

Inherited from Titanium.UI.View

Base elevation of the view relative to its parent in pixels.

ellipsize

BooleanAndroid

Determines whether an ellipsis (...) should be used to indicate truncated text.

Default: false

enableCopy

Booleansince 10.0.1

Determines if user can copy or cut text from the text field.

When set false, the "copy" and "cut" options will not appear in the context menu. The Command+C and Command+X keyboard shortcuts will be ignored as well.

If Titanium.UI.TextField.passwordMask is set true, then copy support is always disabled, even if you set this property true.

Default: true

Determines whether the return key is enabled automatically when there is text in this text field.

If true, the return key is disabled when this text field is empty, and automatically enabled as soon as the user types any text in the field.

On Android, if true, return event will not fire. Clicking on the return key will do nothing, but the key itself won't be disabled.

Default: false

focusable

BooleanAndroid

Inherited from Titanium.UI.View

Whether view should be focusable while navigating with the trackball.

Default: false

focused

Booleansince 9.1.0read-only

Determines whether this TextField has focus.

Default: false

fullscreen

BooleanAndroidsince 6.1.0

Leave some space above the keyboard in landscape mode or not.

Switch between a fullscreen keyboard in landscape mode (default) or a non-fullscreen keyboard which will leave some space to display UI elements.

Default: true

hintText

String

Hint text to display when the field is empty.

Hint text is hidden when the user enters text into this text field.

Use the backslash and letter n line feed character combination, ie \n, to force a new line.

Use unicode characters, such as those included in (but not limited to) the Unicode List of Useful Symbols section of wikipedia, to insert special characters and symbols.

Default: No hint text.

hintTextColor

String | Titanium.UI.Colorsince iPhone 5.4.0, iPad 5.4.0, Android 4.1.0

Hint text color to display when the field is empty.

Sets the color of the Titanium.UI.TextField.hintText. Please not that this can be overriden by the Titanium.UI.TextField.attributedHintText which provides an advanced configuration to style hint texts.

This has no effect when used with hintType Ti.UI.HINT_TYPE_ANIMATED. Instead a theme must be used that defines the android:textColorHint attribute.

Android Note: The hint text color in Android is determined by the theme of the application. By default, a Titanium app uses a Dark theme. When you create the background to be white, the hint text color would also be white, hence not visible to the user. To change this, you can edit the tiapp.xml file with another theme. Example as follows:

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:theme="@style/Theme.MaterialComponents.Light.Bridge"/>
    </manifest>
</android>

Another way to change the hint text color is to use this property and specify a color.

Default: The platform's default hint text color.

hinttextid

Stringsince 6.2.0

Key identifying a string from the locale file to use for the hintText property.

Only one of hintText or hinttextid should be specified.

inputType

Array<Number>Androidsince 5.2.0

Input type to accept in the text field. Also influences the Keyboard type to display.

When asking for a specific kind of user input, such as a phone number or email address, you should always specify the input type that is accepted. This overrides any changes to the keyboard done by the property Titanium.UI.TextField.keyboardType.

Default: Empty array. If not defined, default is Keyboard type specified by <Titanium.UI.TextField.keyboardType>.

Array of toolbar button objects or a toolbar to be used when the keyboard is displayed.

In Alloy, you can use a <KeyboardToolbar> element inside a <TextField> element to create a KeyboardToolbar.

<Alloy>
    <TextField id="textfield" platform="ios" hintText="Tap here...">
        <!-- Nested properties -->
        <KeyboardToolbar >
            <Toolbar >
                <Items >
                    <Button>button 1</Button>
                    <FlexSpace />
                    <Button>button 2</Button>
                </Items>
            </Toolbar>
        </KeyboardToolbar>
    </TextField>
</Alloy>

keyboardToolbarHeight

NumberiPhoneiPadmacOS

Height of the keyboard toolbar if keyboardToolbar is an array.

Keyboard type to display when this text field is focused.

When asking for a specific kind of user input, such as a phone number or email address, you should always specify the appropriate keyboard type.

Accepts 11 constants

Default: <Titanium.UI.KEYBOARD_TYPE_DEFAULT>

layout

String

Inherited from Titanium.UI.View

Specifies how the view positions its children. One of: 'composite', 'vertical', or 'horizontal'.

left

Number | String

Inherited from Titanium.UI.View

View's left position, in platform-specific units.

Left button view to display in the TextField.

Set the width and height properties of the button or else it does not display in the text field.

Using an object other than a Button may have unpredictable results.

In Alloy you can use a <LeftButton> element inside the <TextField> element.

<Alloy>
    <Window>
        <!-- iOS TextField properties -->
        <TextField id="textfield" platform="ios">
            <LeftButton>
                <Button onClick="sayHi">Say Hi</Button>
            </LeftButton>
            <RightButton>
                <Button onClick="doAlert">Do Alert</Button>
            </RightButton>
        </TextField>
    </Window>
</Alloy>

leftButtonPadding

NumberiPhoneiPadmacOS

Padding between the left button and the edge of the field.

maxLength

NumberAndroidiPhonesince 3.0.0

Maximum length of text field input.

Any attempt to input text beyond this length (including pasting a string larger than maxLength) will not edit the field's contents. A value of -1 indicates unlimited length.

Default: -1

minimumFontSize

NumberiPhoneiPadmacOS

Minimum size of the font when the font is sized based on the contents. Enables font scaling to fit.

opacity

Number

Inherited from Titanium.UI.View

Opacity of this view, from 0.0 (transparent) to 1.0 (opaque). Defaults to 1.0 (opaque).

padding

TextFieldPaddingsince 6.0.0

Sets the padding of this text field.

Obscure the input text from the user.

Set to true to hide entered characters.

Note: on iOS, passwordMask must be specified when this text field is created.

Default: false

passwordRules

StringiPhoneiPadmacOSsince 7.5.0

Set password rules that should be used for this text field.

This property is used to communicate requirements for passwords for your service to ensure iOS can generate compatible passwords for users. It only works when Titanium.UI.TextField.passwordMask is true. You do not need to use this property if the passwords that iOS generates are already compatible with your service. You can learn more about the purpose of and syntax for these rules on the Password Rules documentation guide.

rect

DimensionWithAbsolutessince 2.0.0read-only

Inherited from Titanium.UI.View

The bounding box of the view relative to its parent, in system units.

Right button view.

Set the width and height properties of the button or else it does not display in the text field.

Using an object other than a Button may have unpredictable results. In Alloy you can use a <RightButton> element inside the <TextField> element.

<Alloy>
    <Window>
        <!-- iOS TextField properties -->
        <TextField id="textfield" platform="ios">
            <LeftButton>
                <Button onClick="sayHi">Say Hi</Button>
            </LeftButton>
            <RightButton>
                <Button onClick="doAlert">Do Alert</Button>
            </RightButton>
        </TextField>
    </Window>
</Alloy>

The sayHi and doAlert methods are defined in the Alloy controller.

rightButtonPadding

NumberiPhoneiPadmacOS

Padding between the right button and the edge of the field.

rotation

NumberAndroidiPhoneiPadsince Android 5.4.0, iPhone 12.3.0, iPad 12.3.0

Inherited from Titanium.UI.View

Clockwise 2D rotation of the view in degrees.

selection

textFieldSelectedParamssince 3.3.0read-only

Returns the currently selected text of the text field.

This property is useful to track the current cursor position of the text field. On iOS this property can only be used when the text field has focus. Accessing this property when text field does not have focus will return an undefined value.

This method will return null on android and undefined on iOS if the view has not yet been attached to the window.

showUndoRedoActions

BooleaniPadmacOSsince 5.0.0

Determinates if the undo and redo buttons on the left side of the keyboard should be displayed or not. Only valid on iOS9 and above.

Default: true

suppressReturn

BooleaniPhoneiPadmacOS

Determines whether the return key should be suppressed during entry.

tooltip

Stringsince 12.1.0iOS 15.0+

Inherited from Titanium.UI.View

The default text to display in the control's tooltip.

touchFeedback

BooleanAndroidsince 6.1.0

Inherited from Titanium.UI.View

A material design visual construct that provides an instantaneous visual confirmation of touch point.

Default: false

translationX

NumberAndroidsince 5.0.0

Inherited from Titanium.UI.View

Horizontal location of the view relative to its left position in pixels.

value

String

Value of this text field, which may be set programmatically and modified by the user.

Use the backslash and letter n line feed character combination, ie \n, to force a new line.

Use unicode characters, such as those included in (but not limited to) the Unicode List of Useful Symbols section of wikipedia, to insert special characters and symbols.

Methods 17

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.

Forces the field to lose focus.

convertPointToView

since Android 1.8, iPhone 1.8, iPad 1.8, macOS 9.2.0

Inherited from Titanium.UI.View

Translates a point from this view's coordinate system to another view's coordinate system.

Parameters
ParametersTypeDescription
pointPoint

A point in this view's coordinate system.

If this argument is missing an x or y property, or the properties can not be converted into numbers, an exception will be raised.

destinationViewTitanium.UI.View

View that specifies the destination coordinate system to convert to. If this argument is not a view, an exception will be raised.

Returns Point

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.

Forces the field to gain focus.

getViewById

since 6.1.0

Inherited from Titanium.UI.View

Returns the matching view of a given view ID.

Parameters
ParametersTypeDescription
idString

The ID of the view that should be returned. Use the id property in your views to enable it for indexing in this method.

hasText

since 2.1.0

Returns true if this text field contains text.

Returns Boolean

True if this text field contains text.

Inherited from Titanium.UI.View

Hides this view.

Parameters
ParametersTypeDescription
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 { animated: false }

insertAt

since 3.3.0

Inherited from Titanium.UI.View

Inserts a view at the specified position in the children array.

Parameters
ParametersTypeDescription
paramsViewPositionOptions

Pass an object that specifies the view to insert and optionally at which position (defaults to end)

2 fields
position? Number

Position in the children array of the view element to replace.

view Titanium.UI.View

View to insert. Required.

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.

setSelection

since 3.0.0

Selects the text in range (start, end).

Selects the text in range (start, end). If start equals end, no text will be selected, and the cursor will move to the start position. End is not inclusive, meaning setSelection(0,0) will not select the first character, but will move the cursor to the position before the first character.

On iOS, soft keyboard would show when text is selected.

Parameters
ParametersTypeDescription
startNumber

Start index for selection. Value ranges from 0 to the text's length.

endNumber

End index for selection, not inclusive. Value ranges from 0 to the text's length.

Inherited from Titanium.UI.View

Makes this view visible.

Parameters
ParametersTypeDescription
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 { animated: false }

Inherited from Titanium.UI.View

Returns an image of the rendered view, as a Blob.

Parameters
ParametersTypeDescription
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 21

Fired when the field loses focus.

Event properties
Event propertiesTypeDescription
valueString

Value of the field.

Fired when the field value changes.

Event properties
Event propertiesTypeDescription
valueString

New value of the field.

Inherited from Titanium.UI.View

Fired when the device detects a click against the view.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the click passed through an overlapping window belonging to another app.

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
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the double click passed through an overlapping window belonging to another app.

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
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the double tap passed through an overlapping window belonging to another app.

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.

empty

Androidsince 12.4.0

Fired when the field is empty and you press backspace key again.

Event properties
Event propertiesTypeDescription
keyCodeNumber

Key code of the key.

Fired when the field gains focus.

Event properties
Event propertiesTypeDescription
valueString

Value of the field.

keypressed

since Android 3.1.0, iPhone 5.4.0, iPad 5.4.0, macOS 9.2.0

Inherited from Titanium.UI.View

Fired when a hardware key is pressed in the view.

Event properties
Event propertiesTypeDescription
keyCodeNumber

The code for the physical key that was pressed. For more details, see KeyEvent. This API is experimental and subject to change.

Inherited from Titanium.UI.View

Fired when the device detects a long press.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the long press passed through an overlapping window belonging to another app.

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.0

Inherited from Titanium.UI.View

Fired when the device detects a pinch gesture.

Event properties
Event propertiesTypeDescription
scaleNumber

The scale factor relative to the points of the two touches in screen coordinates.

velocityNumber

The velocity of the pinch in scale factor per second.

timeNumber

The event time of the current event being processed.

timeDeltaNumber

The time difference in milliseconds between the previous accepted scaling event and the current scaling event.

currentSpanNumber

The average distance between each of the pointers forming the gesture in progress through the focal point.

currentSpanXNumber

The average X distance between each of the pointers forming the gesture in progress through the focal point.

currentSpanYNumber

The average Y distance between each of the pointers forming the gesture in progress through the focal point.

previousSpanNumber

The previous average distance between each of the pointers forming the gesture in progress through the focal point.

previousSpanXNumber

The previous average X distance between each of the pointers forming the gesture in progress through the focal point.

previousSpanYNumber

The previous average Y distance between each of the pointers forming the gesture in progress through the focal point.

focusXNumber

The X coordinate of the current gesture's focal point.

focusYNumber

The Y coordinate of the current gesture's focal point.

inProgressBoolean

Returns true if a scale gesture is in progress, false otherwise.

Fired when the return key is pressed on the keyboard.

Event properties
Event propertiesTypeDescription
valueString

Value of this text area.

rotate

since 12.7.0

Inherited from Titanium.UI.View

Fired when the device detects a two finger rotation.

Event properties
Event propertiesTypeDescription
rotateNumber

Rotation in degrees.

Inherited from Titanium.UI.View

Fired when the device detects a single tap against the view.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the single tap passed through an overlapping window belonging to another app.

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
Event propertiesTypeDescription
directionString

Direction of the swipe--either 'left', 'right', 'up', or 'down'.

xNumber

X coordinate of the event's endpoint from the source view's coordinate system.

yNumber

Y coordinate of the event's endpoint from the source view's coordinate system.

obscuredBoolean

Returns true if the swipe passed through an overlapping window belonging to another app.

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
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

forceNumber

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.

sizeNumber

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForceNumber

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.

altitudeAngleNumber

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.

timestampNumber

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.

azimuthUnitVectorInViewXNumber

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.

azimuthUnitVectorInViewYNumber

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.

obscuredBoolean

Returns true if the touch passed through an overlapping window belonging to another app.

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
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

forceNumber

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.

sizeNumber

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForceNumber

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.

altitudeAngleNumber

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.

timestampNumber

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.

azimuthUnitVectorInViewXNumber

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.

azimuthUnitVectorInViewYNumber

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.

obscuredBoolean

Returns true if the touch passed through an overlapping window belonging to another app.

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 movement of a touch.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

forceNumber

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.

sizeNumber

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForceNumber

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.

altitudeAngleNumber

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.

timestampNumber

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.

azimuthUnitVectorInViewXNumber

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.

azimuthUnitVectorInViewYNumber

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.

obscuredBoolean

Returns true if the touch passed through an overlapping window belonging to another app.

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
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

forceNumber

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.

sizeNumber

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForceNumber

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.

altitudeAngleNumber

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.

timestampNumber

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.

azimuthUnitVectorInViewXNumber

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.

azimuthUnitVectorInViewYNumber

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.

obscuredBoolean

Returns true if the touch passed through an overlapping window belonging to another app.

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.0

Inherited from Titanium.UI.View

Fired when the device detects a two-finger tap against the view.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the tap passed through an overlapping window belonging to another app.

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.