我目前正在处理下面的代码,下面的代码是钛合金中的 ios navigationGroup。我正在尝试制作它或同时制作 ios 和 android,但它似乎很复杂。我怎样才能为 ios 和 android 制作它。
var win1 = Titanium.UI.createWindow();
var win2 = Titanium.UI.createWindow({
backgroundColor: 'white',
barColor: '#336699'
});
var win3 = Titanium.UI.createWindow({
backgroundColor: 'white',
barColor: '#336699',
title: 'Register'
});
var win4 = Titanium.UI.createWindow({
backgroundColor: 'white',
barColor: '#336699',
title: 'Sign in'
});
//create view1
var view1 = Titanium.UI.createView();
//create label1
var label1 = Titanium.UI.createLabel({
text: 'Welcome',
height: 40,
width: 250,
top: 100,
color: '#336699'
});
//create button1
var button1 = Titanium.UI.createButton({
title: 'Register',
height: 35,
width: 100,
top: 210
});
button1.addEventListener('click', function(){
nav.open(win3);
});
var nav = Titanium.UI.iPhone.createNavigationGroup({
window: win2
});
//create view2
var view2 = Titanium.UI.createView();
//create label2
var label2 = Titanium.UI.createLabel({
height: 45,
width: 200,
top: 145,
color: '#336699'
});
//create button2
var button2 = Titanium.UI.createButton({
title: 'Sign in',
height: 35,
width: 100,
top: 250
});
button2.addEventListener('click', function(){
nav.open(win4, {animated:true});
});
var nav = Titanium.UI.iPhone.createNavigationGroup({
window: win2
});
view2.add(button1);
view1.add(label1);
win2.add(view1);
view2.add(button2);
view2.add(label2);
win2.add(view2);
win1.add(nav);
win1.open();