我想我可能将过多的正常上下文(网络应用程序开发)应用到使用 Titanium 的新移动项目中。我有一个包含几个按钮的主屏幕。我需要每个按钮打开一个包含全新内容的新窗口。在我的脑海中,我只是假设窗口会像请求或页面一样工作,因为创建和打开新窗口将完全用新内容替换现有内容。情况似乎并非如此(或者我正在做一些可怕的、可怕的错误)。在我的主屏幕上,这是一个按钮的事件处理程序:
btn_er_app.addEventListener( 'click', function( e ) {
var win = Ti.UI.createWindow({
bottom: 0,
title: 'Next "Page"',
top: 0,
url: 'next_page.js',
});
win.open({ animated: true });
});
我的next_page.js
页面看起来像这样(片段):
var win = Ti.UI.currentWindow;
win.layout = 'vertical';
var header = Ti.UI.createView({
backgroundColor: '#f00',
height: 60,
top: 0,
});
win.add( header );
var body = Ti.UI.createView({
backgroundColor:'#000',
backgroundImage: '/images/body.png',
});
var label = Ti.UI.createLabel({
text: 'Page Bits Go Here',
textAlign: 'center',
});
body.add( label );
win.add( body );
我发现主屏幕内容仍然可见。显示红色标题块,但不显示正文视图。我试过设置 properties: height: '100%'
, bottom: 0
,height: 'auto'
甚至将新窗口的fullscreen
值设置为 true,但没有任何效果。
首先,“链接”在移动领域是如何运作的?我真的认为我的整个思考过程都需要重新调整,其次,我需要做什么才能让我的新窗口完全遮住底层的主屏幕窗口?
谢谢你的帮助。