所以我使用Alloy获得了简单的标签Titanium Mobile应用程序。我试图通过税收标签中的按钮打开新视图:
index.xml(view)
<Alloy>
<TabGroup>
<Require src="taxes" />
</TabGroup>
taxes.xml(查看)
<Alloy>
<Tab id="taxes" title="Taxes" icon="taxes.png">
<Window title="Taxes" class="container">
<Toolbar bottom="0">
<Items>
<Button id="newrecord" title="New Record" onClick="newRecord"></Button>
</Items>
</Toolbar>
</Window>
</Tab>
taxes.js(控制器)
var args = arguments[0] || {};
function newRecord() {
var new_record_view = Alloy.createController('newrecord').getView();
new_record_view.open();
}
newrecord.xml(查看)
<Alloy>
<Window title="New Record" class="container" id="newrecord">
New Record
</Window>
</Alloy>
当我点击按钮时,一切都冻结了。
如果我尝试将tax.js中newRecord()函数的代码更改为在当前选项卡中打开,则会给出以下错误:
taxes.js(控制器)
function newRecord() {
var new_record_view = Alloy.createController('newrecord');
new_record_view.openMainWindow($.taxes);
}
newrecord.js(控制器)
exports.openMainWindow = function(_tab) {
_tab.open($.newrecord);
}
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at :0";
[ERROR] : line = 31;
[ERROR] : message = "Invalid type passed to function";
[ERROR] : nativeLocation = "-[TiUITabProxy openWindow:] (TiUITabProxy.m:225)";
[ERROR] : nativeReason = "expected: TiWindowProxy, was: (null)";
[ERROR] : sourceId = 301260640;
[ERROR] : sourceURL = "file:///Users/dimitar/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/8FD72932-FC27-43D4-9D3D-33F34F3E3039/autoservice.app/alloy/controllers/taxes.js";
[ERROR] : }
编辑:
所以,问题是我试图用id child_window而不是新记录打开窗口。现在没有错误,窗口打开了,但它看起来有这样的故障,可以在视频中看到:
答案 0 :(得分:2)
所以基本上是错误输入的windows id引起了问题而且“故障”只不过是从具有浅色背景的窗口快速切换动画到具有深色背景的窗口。