-
Notifications
You must be signed in to change notification settings - Fork 7
/
app.js
47 lines (39 loc) · 969 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var win = Ti.UI.createWindow({
backgroundColor: "#ffffff",
exitOnClose: true,
});
var tabbedBar = require("/ui/modules/TabbedBar");
var bar = tabbedBar.createTabbedBar({
labels: ["Tab 1", "Tab 2", "Tab 3", "Tab 4", "Tab 5"],
index: 0,
selectedColor: "#ffffff",
tintColor: "#007AFF",
top: 0,
width: "90%"
});
var animation = Titanium.UI.createAnimation({
duration: 500
});
bar.addEventListener("click", function (e) {
Ti.API.info(e.index);
switch (e.index) {
case 0:
animation.backgroundColor = "white";
break;
case 1:
animation.backgroundColor = "red";
break;
case 2:
animation.backgroundColor = "green";
break;
case 3:
animation.backgroundColor = "blue";
break;
case 4:
animation.backgroundColor = "black";
break;
}
win.animate(animation);
});
win.add(bar);
win.open();