# Titanium.UI.iOS.PreviewAction

> A PreviewAction provides options to configure actions used by the iOS 9 3D-Touch "Peek and Pop" feature.

- Source: https://titaniumsdk.com/docs/sdk/13.1.0/Titanium.UI.iOS.PreviewAction
- Titanium SDK version: 13.1.0
- Kind: proxy
- Platforms: iPhone
- Since: Titanium SDK 5.1.0
- Extends: Titanium.Proxy
- Inheritance: Titanium.Proxy

The PreviewAction is created by the [Titanium.UI.iOS.createPreviewAction](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.md#createPreviewAction) method. Set the
`title` property when creating a PreviewAction object.

Use this class to configure preview actions used in the [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md). The actions
can also be part of the [Titanium.UI.iOS.PreviewActionGroup.actions](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewActionGroup.md#actions) property.

For an example, see [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md).

See also:

* [iOS Developer Library: Adopting 3D Touch on iPhone](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/Adopting3DTouchOniPhone/3DTouchAPIs.html)

## Properties

### style

- Type: Number
- Platforms: iPhone
- Default: `Titanium.UI.iOS.PREVIEW_ACTION_STYLE_DEFAULT`

The style of the action.

Accepts: `Titanium.UI.iOS.PREVIEW_ACTION_STYLE_DEFAULT`, `Titanium.UI.iOS.PREVIEW_ACTION_STYLE_DESTRUCTIVE`, `Titanium.UI.iOS.PREVIEW_ACTION_STYLE_SELECTED`

### title

- Type: String
- Platforms: iPhone

The title of the action.

Provides a title to be shown when "peeking" a view referenced in the [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md).

## Events

### click

- Platforms: iPhone

Fired when the device detects a click against a preview action.

This event provides different properties depending on the view the [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md)
is assigned to. Every event has the `index` property to identify the clicked action. If the [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md)
is assigned to a [Titanium.UI.ListView](https://titaniumsdk.com/docs/sdk/Titanium.UI.ListView.md), the event provides the additional properties `itemIndex`, `sectionIndex` 
and `itemId` to identify the previewed row and section, respectively.

Event properties:

- `index` (Number): The index of the clicked action.
- `itemIndex` (Number): The index of the clicked row, if the `previewContext` property of the [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md) is a [Titanium.UI.ListView](https://titaniumsdk.com/docs/sdk/Titanium.UI.ListView.md).
- `sectionIndex` (Number): The index of the clicked section, if the `previewContext` property of the [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md) is a [Titanium.UI.ListView](https://titaniumsdk.com/docs/sdk/Titanium.UI.ListView.md).
- `itemId` (String): The item ID of cell, if the `previewContext` property of the [Titanium.UI.iOS.PreviewContext](https://titaniumsdk.com/docs/sdk/Titanium.UI.iOS.PreviewContext.md) is a [Titanium.UI.ListView](https://titaniumsdk.com/docs/sdk/Titanium.UI.ListView.md).

## Inherited members

6 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/13.1.0/Titanium.Proxy.md): `addEventListener`, `apiName`, `applyProperties`, `bubbleParent`, `fireEvent`, `removeEventListener`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

