【问题标题】:trying to add an xml file to app试图将 xml 文件添加到应用程序
【发布时间】:2013-06-26 13:48:09
【问题描述】:
所以我正在用钛合金制作一个应用程序,我希望该应用程序能够识别我制作的 XML 文件。例如,当我在我的控制器文件夹中创建一个新的 JS 文件时,我需要将此代码添加到alloy.js 文件中。
Alloy.createController("sub_board");
添加我在 Views 文件夹中创建的 xml 文件的代码是什么?
【问题讨论】:
标签:
xml
titanium
titanium-alloy
【解决方案1】:
由于控制器和视图具有相同的基本名称,因此您可以执行以下操作
// create a controller
Alloy.createController("sub_board");
获取视图
//get the view for the controller sub_board.xml
Alloy.createController("sub_board").getView();
或
// in seperate variables
var controller = Alloy.createController("sub_board");;
var view controller.getView();