钛窗口删除子视图

Titanium Window removes child views

本文关键字:视图 删除 窗口      更新时间:2023-09-26

>我在钛合金(最新版本)中创建了一个窗口A,并添加了一些效果良好的视图。

    var winA = Titanium.UI.createWindow({  
        backgroundColor: bgColor,
        statusBarHidden:true
    });
    var circle = createDragCircle('Dent'); //This is a Ti.Draggable view
    winA.add(circle);

然后我打开一个模态窗口 B,即:

    winB.open({modal: true});

winB 打开正常,但按原样,打开我添加的所有 winA 子视图都将被删除。我可以说它没有重新加载 winA。

这是默认行为吗?

编辑:

还行。在进一步调查中,它不会删除添加的视图。它会将它们重置为拖动事件之前的位置。本质上,我正在执行以下操作:

    var drag = require('ti.draggable'); 
    var win = Titanium.UI.createWindow({  
       backgroundColor: bgColor,
       statusBarHidden:true
    });
    var circle = drag.createView({
        height: 30,
        width: 30,
        zIndex: 100,
        top: top,
        left: 25,
        minLeft: 65,
        maxLeft: 285,
        minTop: 105,
        maxTop: 370,            
        isDragged: false,
        type: type
    });
    //Add an event listener to catch drag end
    circle.addEventListener('end', function(e) {
        var editwin; //Call to create winB
        editwin.open({modal: true});
    });

winB 打开正常,但圆形对象移回拖动之前的位置。

如果您在具有模态属性的winA中打开winB,那么它将产生问题。

谢谢大家的帮助。

我通过执行以下操作对其进行了整理:

    circle.addEventListener('end', function(e) {
        this.top = e.source.top;
        this.left = e.source.left;
    });

这会强制对象采用 drop top 和 left 属性。