A menu popup provides the ability to create custom tooltip options using the items
property
covering the native UIMenuController
class.
See also:
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();
The name of the API that this proxy corresponds to.
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button
.
Indicates if the proxy will bubble an event to its parent.
Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.
Default: true
The items of the menu popup.
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.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.
Adds the specified callback as an event listener for the named event.
Name of the event.
Callback function to invoke when the event is fired.
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
A dictionary of properties to apply.
Fires a synthesized event to any registered listeners.
Name of the event.
A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.
Hides the menu popup.
Includes options how the menu popup should be hidden.
Indicates whether the menu popup is currently visible.
Removes the specified callback as an event listener for the named event.
Multiple listeners can be registered for the same event, so the
callback
parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function in order to remove the listener later:
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
To remove the listener, pass in a reference to the callback function:
window.removeEventListener('click', listener);
Name of the event.
Callback function to remove. Must be the same function passed to addEventListener
.
Sets the value of the bubbleParent property.
New value for the property.
Sets the value of the items property.
New value for the property.
Sets the value of the lifecycleContainer property.
New value for the property.
Shows the menu popup.
Includes options how the menu popup should be shown.
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.
The index of the clicked item.
The title of the clicked item.
Source object that fired the event.
Name of the event fired.
True if the event will try to bubble up if possible.
Set to true to stop the event from bubbling.