【问题标题】:Titanium iOS : Show window on topTitanium iOS:在顶部显示窗口
【发布时间】:2014-06-11 14:07:06
【问题描述】:

我创建了 3 个窗口 A、B、C。窗口 B 是从窗口 A 中打开的。窗口 C 是从窗口 B 中打开的。

但问题是窗口 C 显示在 A 和 B 之间。我希望此窗口显示在 B 之上。在 android 中可以正常工作,但在 iOS 中不行。

以下是代码: 1. 窗口A

var chatBoxWindow = Titanium.UI.createWindow({
        top : Ti.API.top,
        url : '',
        left : '100%',
        width : '100%',
        zIndex : 100,
        orientationModes : [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT, Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT]
    });
chatBoxWindow.open();
  1. 窗口 B

    var modal = require("/ui/common/smileypopup").modalWin; var popupWin = new modal(); popupWin.open();

  2. 窗口 C(笑脸选择器)

    backgroundColor : '透明', id : 'popupWin'

【问题讨论】:

  • 能否展示图片和代码
  • 实际上代码太大无法粘贴。创建笑脸选择器(窗口 C)。但此窗口未显示在顶部。你想要笑脸窗口代码吗??
  • 只是你打开窗户的代码。

标签: titanium titanium-mobile


【解决方案1】:

窗口 C 必须是窗口吗?根据你的代码,我真的不能说。所以有了这个假设,看看以下是否有帮助:

如何为 C 创建一个 View 作为 commonJS 文件并在窗口 B 中调用它:

//Code for Smileypopup which is really just a view

function Smileypopup(){

    var self = Ti.UI.createView({

        top:0,width:Ti.UI.FILL,height:Ti.UI.FILL,
        backgroundColor:'transparent',
        id:'smileypopup'
    });
    //add your smiley code picker code along with
    //your functions using the self.functionname(){}; approach

    return self;
}
module.exports = Smileypopup;

然后在Window B里面的commonJS调用WindowC

function WindowB(){

    var Smileypopup = require('/ui/common/Smileypopup');
    var popup = new Smileypopup();

    var self = Ti.UI.createWindow({});

        self.add(popup);
        self.showPopup = function(){ popup.show(); };
        self.hidePopup = function(){ popup.hide(); };

    return self;
}
module.exports = WindowB;

最后,在窗口 A 内,您可以照常进行。听起来 C 可以是一个视图,而不是创建另一个窗口。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-20
    • 2011-05-25
    • 1970-01-01
    • 1970-01-01
    • 2019-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多