2013-09-07 1 views
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; 
}; 

답변

0

많은 차이가 없습니다. 그러나 코딩과 관련하여 윈도우의 팝업 효과는 modal : true 키워드로 수행됩니다. 전망에서 당신은 디자인에 많은 노력을 기울여야합니다. 클라이언트 측 즉 모바일 사용자와 쉽게 구별 할 수 없습니다.

+0

여기서 모달 : true 키워드는 맞춤 op 화면에 사용되었습니다. –

+0

질문이나 답변입니까? – lopa

+0

질문 .. 실제로 사용자 정의 팝업을 사용했을 때 모달을 사용하지 않았습니다. –

관련 문제