-
-
Save billdawson/e6afc266f09188a73756 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Titanium.UI.View | |
description: The View is an empty drawing surface or container. The View is created by the method `Titanium.UI.createView`. | |
extends: Titanium.Proxy | |
since: "0.9" | |
methods: | |
- name: add | |
description: add a child to the view hierarchy | |
parameters: | |
- name: view | |
description: the view to add to this views hiearchy | |
type: Titanium.UI.View | |
- name: animate | |
description: animate the view | |
parameters: | |
- name: properties | |
description: either a dictionary of animation properties or an Animation object | |
type: [Dictionary<Titanium.UI.Animation>, Titanium.UI.Animation] | |
- name: callback | |
description: function to be invoked upon completion of the animation | |
type: Callback | |
- name: hide | |
description: hide the view | |
- name: remove | |
description: remove a previously add view from the view hiearchy | |
parameters: | |
- name: view | |
description: the view to remove from this views hiearchy | |
type: Titanium.UI.View | |
- name: show | |
description: make the view visible | |
- name: toImage | |
returns: | |
type: Titanium.Blob | |
description: return a Blob image of the rendered view | |
parameters: | |
- name: f | |
description: function to be invoked upon completion. if non-null, this | |
method will be performed asynchronously. if null, it will be performed immediately | |
type: Callback | |
properties: | |
- name: anchorPoint | |
type: PointDictionary | |
description: specifies the position by which animation should occur. center is 0.5, 0.5 | |
- name: animatedCenterPoint | |
type: PointDictionary | |
platforms: [iphone, ipad] | |
permission: read-only | |
description: read-only object with x and y properties of where the view is during animation | |
- name: backgroundColor | |
type: String | |
description: the background color of the view | |
- name: backgroundDisabledColor | |
type: String | |
platforms: [android] | |
description: the disabled background color of the view. | |
- name: backgroundDisabledImage | |
type: String | |
platforms: [android] | |
description: the disabled background image url of the view. | |
- name: backgroundFocusedColor | |
type: String | |
platforms: [android] | |
description: the focused background color of the view. focusable must be true for normal views. | |
- name: backgroundFocusedImage | |
type: String | |
platforms: [android] | |
description: the focused background image url of the view. focusable must be true for normal views. | |
- name: backgroundGradient | |
type: GradientDictionary | |
platforms: [iphone, ipad] | |
- name: backgroundImage | |
type: String | |
description: the background image url of the view | |
- name: backgroundLeftCap | |
type: Number | |
platforms: [iphone, ipad] | |
description: End caps specify the portion of an image that should not be resized | |
when an image is stretched. This technique is used to implement buttons and | |
other resizable image-based interface elements. When a button with end caps is | |
resized, the resizing occurs only in the middle of the button, in the region between | |
the end caps. The end caps themselves keep their original size and appearance. This | |
property specifies the size of the left end cap. The middle (stretchable) portion is | |
assumed to be 1 pixel wide. The right end cap is therefore computed by adding the size | |
of the left end cap and the middle portion together and then subtracting that value from | |
the width of the image | |
- name: backgroundSelectedColor | |
type: String | |
platforms: [android] | |
description: the selected background color of the view. focusable must be true for normal views. | |
- name: backgroundSelectedImage | |
type: String | |
platforms: [android] | |
description: the selected background image url of the view. focusable must be true for normal views. | |
- name: backgroundTopCap | |
type: Number | |
platforms: [iphone, ipad] | |
description: End caps specify the portion of an image that should not be resized when | |
an image is stretched. This technique is used to implement buttons and other | |
resizable image-based interface elements. When a button with end caps is resized, | |
the resizing occurs only in the middle of the button, in the region between the end | |
caps. The end caps themselves keep their original size and appearance. This property | |
specifies the size of the top end cap. The middle (stretchable) portion is assumed to | |
be 1 pixel wide. The bottom end cap is therefore computed by adding the size of the | |
top end cap and the middle portion together and then subtracting that value from the | |
height of the image | |
- name: borderColor | |
type: String | |
description: the border color of the view | |
- name: borderRadius | |
type: Number | |
description: the border radius of the view | |
- name: borderWidth | |
type: Number | |
description: the border width of the view | |
- name: bottom | |
type: [Number,String] | |
description: property for the view bottom position. This position is relative to the view's | |
parent. Can be either a float value or a dimension string ie 'auto' (default). | |
- name: center | |
type: Object | |
description: a dictionary with properties x and y to indicate the center of the | |
views position relative to the parent view | |
- name: focusable | |
type: Boolean | |
platforms: [android] | |
description: Set true if you want a view to be focusable when navigating with the | |
trackball or D-Pad. Default is false. | |
- name: height | |
type: [Number,String] | |
description: property for the view height. Can be either a float value or a dimension | |
string ie 'auto' (default). | |
- name: left | |
type: [Number,String] | |
description: property for the view left position. This position is relative to the view's | |
parent. Can be either a float value or a dimension string ie 'auto' (default). | |
- name: opacity | |
type: Number | |
description: the opacity from 0.0-1.0 | |
- name: right | |
type: [Number,String] | |
description: property for the view right position. This position is relative to the view's | |
parent. Can be either a float value or a dimension string ie 'auto' (default). | |
- name: size | |
type: SizeDictionary | |
description: the size of the view as a dictionary of width and height properties | |
- name: softKeyboardOnFocus | |
type: Number | |
platforms: [android] | |
description: One of `Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS`, | |
`Titanium.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS`, or | |
`Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS`. | |
- name: top | |
type: [Number,String] | |
description: property for the view top position. This position is relative to the view's | |
parent. Can be either a float value or a dimension string ie 'auto' (default). | |
- name: touchEnabled | |
type: Boolean | |
description: a boolean indicating if the view should receive touch events (true, default) | |
or forward them to peers (false) | |
- name: transform | |
type: Titanium.UI.2DMatrix | |
description: the transformation matrix to apply to the view | |
- name: visible | |
type: Boolean | |
description: a boolean of the visibility of the view | |
- name: width | |
type: [Number,String] | |
description: property for the view width. Can be either a float value or a dimension | |
string ie 'auto' (default). | |
- name: zIndex | |
type: Number | |
description: the z index position relative to other sibling views | |
events: | |
- name: click | |
description: fired when the device detects a click (longer than touch) against the view | |
extends: TouchEvent | |
- name: dblclick | |
description: fired when the device detects a double click against the view | |
extends: TouchEvent | |
- name: doubletap | |
description: fired when the device detects a double tap against the view | |
extends: TouchEvent | |
- name: singletap | |
description: fired when the device detects a single tap against the view | |
extends: TouchEvent | |
- name: swipe | |
description: fired when the device detects a swipe (left or right) against the view | |
extends: TouchEvent | |
properties: | |
- name: direction | |
description: direction of the swipe - either left or right | |
type: String | |
- name: touchcancel | |
description: fired when a touch event is interrupted by the device. this happens in | |
circumenstances such as an incoming call to allow the UI to clean up state. | |
extends: TouchEvent | |
- name: touchend | |
description: fired when a touch event is completed | |
extends: TouchEvent | |
- name: touchmove | |
description: fired as soon as the device detects movement of a touch. Event coordinates | |
are always relative to the view in which the initial touch occurred | |
extends: TouchEvent | |
- name: touchstart | |
description: fired as soon as the device detects a gesture | |
extends: TouchEvent | |
- name: twofingertap | |
description: fired when the device detects a two-finger tap against the view | |
platforms: [iphone, ipad] | |
extends: TouchEvent | |
examples: | | |
## Round View Example | |
Create a rounded View. | |
var view = Titanium.UI.createView({ | |
borderRadius: 10, | |
backgroundColor: 'red', | |
width: 50, | |
height: 50 | |
}); | |
window.add(view); | |
--- | |
name: PointDictionary | |
description: x and y coordinate dictionary | |
properties: | |
- name: x | |
description: x-axis position | |
type: Number | |
- name: y | |
description: y-axis position | |
type: Number | |
--- | |
name: GradientDictionary | |
description: Specifies gradient fill colors, start and end points, etc. | |
properties: | |
- name: type | |
description: ?? # Don't know what this is | |
type: Object | |
- name: startPoint | |
description: start point for the gradient | |
type: PointDictionary | |
- name: endPoint | |
description: end point for the gradient | |
type: PointDictionary | |
- name: startRadius | |
description: start radius | |
type: Number | |
- name: endRadius | |
description: end radius | |
type: Number | |
- name: backfillStart | |
description: backfill start | |
type: PointDictionary # ? Don't really know what it is. | |
- name: backfillEnd | |
description: backfill end | |
type: PointDictionary # ? Don't really know what it is. | |
- name: colors | |
description: array with start and end colors # just guessing | |
type: Array<String> | |
--- | |
name: TouchEvent | |
description: Standard event object for touch events, containing x, y & globalPoint | |
extends: Titanium.Event | |
properties: | |
- name: globalPoint | |
description: a dictionary with properties x and y describing the point of the | |
event in screen coordinates | |
type: PointDictionary | |
- name: y | |
description: the y point of the event, in receiving view coordinates | |
type: Number | |
- name: x | |
description: the x point of the event in receiving view coordiantes | |
type: Number |
No, it needs to be an object. "type" and "description" are possible keys: http://wiki.appcelerator.org/display/guides/TDoc+Specification#TDocSpecification-MethodSpecification
I switched here from the {...} approach to the new-line + indentation + keyname approach. They are equivalent in YAML, but in practice we've adopted the latter.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On line 33, why is the type an object literal with key type and value Ttanium.Blob? Could this al so just be Ttanium.Blob instead of the object, or is there another purpose for this being the way it is?