# Titanium.UI.iOS.MenuPopup
A menu popup provides the ability to create custom tooltip options using the items
property
covering the native UIMenuController
class.
See also:
# Examples
# Example using multiple items
and a click
event.
The example below creates a new menu popup and shows it when the user clicks on the button.
var win = Ti.UI.createWindow({
backgroundColor: "#fff",
});
var button = Ti.UI.createButton({
title: "Show options"
});
win.add(button);
var menu = Ti.UI.iOS.createMenuPopup({
items: ["Option 1", "Option 2"]
});
menu.addEventListener("click", function(e) {
alert(e);
});
button.addEventListener("click", function() {
menu.show({
view: button
});
});
win.open();
# Properties
# items
The items of the menu popup.
The items will be shown as soon in the menu popup when the show
method is called.
To hide them again, use the hide
method in conjunction.
# Methods
# hide
Hides the menu popup.
Parameters
Name | Type | Description |
---|---|---|
options | AnimatedOptions | Includes options how the menu popup should be hidden. Introduced in SDK 5.2.0. Note that the default here is equivalent to passing in |
Returns
- Type
- void
# isVisible
Indicates whether the menu popup is currently visible.
Returns
- Type
- void
# show
Shows the menu popup.
Parameters
Name | Type | Description |
---|---|---|
options | MenuPopupShowParams | Includes options how the menu popup should be shown. Note that the default is to be animated. |
Returns
- Type
- void
# Events
# click
Fired when the user clicks at one of the menu popup items.
This event provides the properties title
and index
which relate to the name and position
of the clicked item inside the items
property.
Properties
Name | Type | Description |
---|---|---|
index | Number | The index of the clicked item. |
title | String | The title of the clicked item. |
source | Object | Source object that fired the event. |
type | String | Name of the event fired. |
bubbles | Boolean | True if the event will try to bubble up if possible. |
cancelBubble | Boolean | Set to true to stop the event from bubbling. |