1

こんにちは、ポップアップ画面を実装しています。実際には、あるサイトから 1 つのコードを見つけました。しかし、それがポップアップ画面またはビューであることを知る方法がわかりません。カスタム ポップアップを使用しない場合は、そのモーダルが好きです。 true .しかし、カスタムポップアップを準備するとき、それがポップアップかスクリーンかを知る方法は?

意見

/FirstView Component Constructor
function SecondView2(data) {
    //create object instance, a parasitic subclass of Observable
    var dataArray =new Array();
    dataArray[0]="naveee";
    var wn = Ti.UI.createWindow({
        backgroundColor:'red'
    });
    var self = Ti.UI.createView({
        layout:"vertical",
        height:300,
        top:40
    });




    // Simplest list data items that can be displayed in a list view
var data = [
    { properties: { title: 'Row 1'} },
    { properties: { title: 'Row 2'} },
    { properties: { title: 'Row 3'} }
];

// Add the list data items to a section
var listSection = Titanium.UI.createListSection({items: data});

// Add the list section to a list view
var listView = Titanium.UI.createListView({sections: [listSection]});


var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];

var table = Ti.UI.createTableView({
  data: tableData
});


listView.addEventListener('itemclick', function(e){

    //alert("ppp"+e.i);
    //add();
    var item = listSection.getItemAt(e.itemIndex);


    var modal = require('ui/common/Third').modalWin;
var popupWin = new modal();
popupWin.open();
  // alert(item.properties.title);
   // alert(e.itemIndex);



});

self.add(listView);




    wn.add(self);

    return wn;
}


**pop up window**

exports.modalWin = function(){

//Popup win
var popupWin = Ti.UI.createWindow({

backgroundColor : 'black',
opacity            : 0.5,
fullscreen        : true,
id                : 'popupWin'
});

//View that used to show the msg
var popupView = Ti.UI.createView({
width    : 200,
height    : 100,
backgroundColor : 'white',
borderRadius : 5,
borderColor : 'red',
borderWidth : 3
});

//A message label is added to the view
popupView.add(Ti.UI.createLabel({ width : 150, height : 'auto', top : 10 ,
text : 'This is Modal Window', backgroundColor : 'green',
font  :  { fontSize : 14, fontWeight : 'bold'}}));
popupWin.add(popupView);

/*Event to close the popup window*/
popupWin.addEventListener('click', function(e){
if(e.source.id != null){
popupWin.close();
}
});
return popupWin;
};
4

1 に答える 1

0

使い勝手に関しては、大差ありません。しかし、コーディングに関する限り、ウィンドウのポップアップ効果は modal:true キーワードによって行われます。ビューにいる間は、デザインに多大な労力を費やす必要があります。クライアント側、つまりモバイル ユーザーとは簡単に区別できません。

于 2013-09-08T14:22:27.747 に答える