# Titanium.UI.iOS.Stepper
A widget used to increment and decrement a value.
# Overview
Default | Custom |
---|---|
A Stepper displays its selected state while it is being pressed.
You can specify background images for each state on iOS.
Use the Titanium.UI.iOS.createStepper method or a <Stepper>
Alloy element to create a stepper
(see the "Examples" section details).
When assigning a custom image to the
backgroundImage
property, 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
backgroundColor
may need to be set to 'transparent'.Note that the stepper cannot be re-sized.
# Examples
# Simple Stepper Example
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var stepper = Ti.UI.iOS.createStepper({
tintColor: "green",
steps: 3,
maximum: 30,
minimum: 0
});
stepper.addEventListener("change", function(e) {
Ti.API.info(e.value);
});
win.add(stepper);
win.open();
# Alloy XML Markup
Previous example as an Alloy view.
stepper.xml:
<Alloy>
<Window id="window">
<Stepper id="stepper" onClick="doClick" tintColor="green" steps="3" />
</Window>
</Alloy>
stepper.js:
function doClick(e) {
alert(e.value);
}
$.window.open();
# Properties
# autorepeat
If YES, the user pressing and holding on the stepper repeatedly alters value. The default value is YES.
# backgroundImage
Background image for the stepper in its normal state, specified as a local file path or URL.
Also sets the background image for other stepper states (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.
# continuous
If YES, value change events are sent immediately when the value changes during user interaction. If NO, a value change event is sent when user interaction ends. The default value is YES.
# decrementDisabledImage
Background image for the stepper decrement button in its disabled state, specified as a local file path or URL. The decrement button enters a disabled state ones the value is equal to the minimumValue , setting the enabled property to false will have no effect to decrement button state.
# decrementImage
Background image for the stepper decrement button in its normal state, specified as a local file path or URL.
Also sets the background image for the other stepper states (disabled, focused, selected), unless they've been specified explicitly, except for iOS, which requires a backgroundImage.
# incrementDisabledImage
Background image for the stepper increment button in its disabled state, specified as a local file path or URL.The increment button enters a disabled state ones the value is equal to the maximumValue , setting the enabled property to false will have no effect to increment button state.
# incrementImage
Background image for the stepper increment button in its normal state, specified as a local file path or URL.
Also sets the background image for the other stepper states (disabled, focused, selected), unless they've been specified explicitly, except for iOS, which requires a backgroundImage.
# maximum
The maximum value the stepper will be set to, the value must be greater than the minimum value. If you attempt to set a value equal to or lower than minimum, the system will default the value to 100.
# minimum
The minimum value the stepper will be set to, the value must be smaller than the maximum value. If you attempt to set a value equal to or greater than maximum, the system will default the value to 0.
# steps
The value the stepper will increment and decrement by, default value for this property is 1. When setting a new value, it must be greater than 1.
# tintColor
Sets the color for the widget, any backgroundImages added will be set to the same color.
For information about color values, see the "Colors" section of Titanium.UI.
Default: null
# Events
# change
Fired every time the stepper value changes.
Properties
Name | Type | Description |
---|---|---|
value | Number | The current value of the stepper. |
minimum | Number | The minimum value of the stepper. |
maximum | Number | The maximum value of the stepper. |
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. |