titanium 入门 4 Alloy框架进一步介绍: widget, builtin
访问量: 4042
Widgets (小组件)
widgets 是可以轻易复用的东东。 widget有自己的model, view, controller, style , assets 。
For information on using widgets in a project, see Importing Widgets.
-
For information on creating widgets, see Creating Widgets.
-
To search publicly available widgets, visit gitTio .
Builtins 小方法
Alloy 提供了某些方法,例如:动画,字符串的操作。这些小方法就叫builtin. 使用起来很简单. 下面是个例子:
点击'shake' button后,屏幕会抖动。
var animation = require(
'alloy/animation'
);
$.shake.addEventListener(
'click'
, function(e) {
animation.shake($.view);
});
See Alloy builtins API documentation for the functionality and usage of builtins.