setupUI(安装ui)
参数:
function main() {
setupUI();
}
ui(获取ui控件)
参数:
function main() {
ui('name').setText('hello');
}
createUI(动态创建界面)
参数:
function main() {
setupUI();
}
function onClick(event) {
var node = createUI(``);
// 在容器的最前面添加
ui('gp').add(node, 0)
}
openUI
参数:
function main() {
openUI('newUI');
}
closeUI
showDialog
参数:
showDialog(0, '是否确认运行该程序', '运行', [{type:'positive', text:'确定', fn: OnConfirmExe}, {type:'negative', text:'取消'}]);
参数:
function main() {
setupUI();
}
function onUIResume() {
var listview = ui('lv');
listview.setData(['hello', 'world']);
}
function onItemLongClick(view, position) {
console.log('item long click position:' + position);
showPopupMenu(view, [{id: 0, text:'编辑'}, {id: 1, text:'删除'}], OnMenuItemClick);
}
function OnMenuItemClick(id) {
console.log('click menu item:' + id);
}
onUIResume
参数:
function onUIResume() {
// 设置ui
ui('item').setText('hello');
}
onUIPause
参数:
function onUIPause() {
// 释放资源
console.log('界面消失了');
}
onBackPressed
参数:
function onBackPressed() {
console.log('按下back键');
}