2014-12-10 4 views
0

appcelerator를 처음 사용했습니다. 튜토리얼을 따르고 있는데 컨텐츠는 기본 창에 있어야하지만 내 코드는 스플래시 화면의 주요 컨텐츠를 보여줍니다. 뒤로 키를 누르면 기본 창이 표시되지만 내용은 표시되지 않습니다. 다음은 내 메인 윈도우 코드입니다.티타늄 : 주 창 대신 스플래시 화면의 주요 내용을 표시하는 응용 프로그램

var win = Ti.UI.currentWindow; 

//-- Create the sub windows 
var crusts = Ti.UI.createWindow(); 
var toppings = Ti.UI.createWindow(); 
var details = Ti.UI.createWindow(); 

//-- We set the background here since this wont change 
win.backgroundImage = '../images/bg_main.png'; 

//-- Include our clock 
Ti.include('../includes/clock.js'); 

//-- The method will close the toppings window and open the crusts window  
function openCrust(e) { 
    crusts.url = 'crusts.js'; 
    crusts.open(); 
    Ti.Ti.API.log('info', 'openCrust Called.'); 
} 

openCrust({}); 

여기서 crust.js은 주 콘텐츠 창이며 코드는입니다.

var win = Ti.UI.currentWindow; 

//-- Our crust views 
var handMade = Ti.UI.createView({width:216,height:156,backgroundImage:'../images/crust/hand.png'}); 
var natural = Ti.UI.createView({width:216,height:156,backgroundImage:'../images/crust/natural.png'}); 
var panCrust = Ti.UI.createView({width:216,height:156,backgroundImage:'../images/crust/pan.png'}); 
var stuffedCrust = Ti.UI.createView({width:216,height:156,backgroundImage:'../images/crust/stuffedCrust.png'}); 
var thinNCrispy = Ti.UI.createView({width:216,height:156,backgroundImage:'../images/crust/thinNcrispy.png'}); 
var returnCrust; 

//-- Crust reference 
var crusts = [ 
    {title:'Hand Made',path:'../images/crust/hand.png'}, 
    {title:'Natural',path:'../images/crust/natural.png'}, 
    {title:'Pan Crust',path:'../images/crust/pan.png'}, 
    {title:'Stuffed Crust',path:'../images/crust/stuffedCrust.png'}, 
    {title:'Thin N Crispy Crust',path:'../images/crust/thinNcrispy.png'} 
]; 

//-- Our scroll view that contains our crust views 
var scrollView = Ti.UI.createScrollableView({ 
    views:[handMade,natural,panCrust,stuffedCrust,thinNCrispy], 
    showPagingControl:true, 
    clipViews:false, 
     top:180, 
     left:30, 
     right:30, 
     height:180, 
     opacity:0 
}); 

//-- Crust title 
var crustTitle = Ti.UI.createLabel({ 
    text:'1. Choose a crust', 
     font:{ 
      fontFamily:'Verdana', 
      fontWeight:'bold', 
      fontSize:24 
     }, 
     color:'#A90329', 
     shadowColor:'#333', 
     shadowOffset:{x:1,y:1}, 
     textAlign:'left', 
     width:Ti.Platform.displayCaps.platformWidth, 
     height:58, 
     left:10 
}); 

//-- Crust title background 
var crustTitleView = Ti.UI.createView({ 
     width:328, 
     height:58, 
     backgroundImage:'../images/crustHeaderBg.png', 
     top:100, 
     left:-6, 
     opacity:0 
}); 
crustTitleView.add(crustTitle); 

//-- Crust type label 
var crustType = Ti.UI.createLabel({ 
     text:'Hand Made', 
     font:{ 
      fontFamily:'Verdana', 
      fontWeight:'bold', 
      fontSize:16 
     }, 
     color:'#fff', 
     shadowColor:'#333', 
     shadowOffset:{x:1,y:1}, 
     textAlign:'center', 
     width:Ti.Platform.displayCaps.platformWidth, 
     height:20, 
     top:170, 
     opacity:0 
}); 

//-- Next Button 
var next = Ti.UI.createButton({ 
     width:137, 
     height:75, 
     backgroundImage:'../images/toppings_next.png', 
     top:385, 
     opacity:0 
}); 

//-- If android OS, use the image property instead of backgroundImage (Ti SDK bug) 
if (Ti.Platform.osname == 'android') 
{ 
    next.image = '../images/toppings_next.png'; 
} 

next.addEventListener('click',function(e){ 
    Ti.App.fireEvent('toppings',{ 
     crust:crusts[scrollView.currentPage].title, 
     path:crusts[scrollView.currentPage].path 
    }); 
}); 

win.add(scrollView); 
win.add(crustTitleView); 
win.add(crustType); 
win.add(next); 

//-- Fade the scrollview in 
scrollView.animate({ 
    opacity:1, 
    duration:500 
}); 

//-- Fade the crust title in 
crustTitleView.animate({ 
    opacity:1, 
    duration:500 
}); 

crustType.animate({ 
    opacity:1, 
    duration:500 
}); 

//-- Fade the next button in 
next.animate({ 
    opacity:1, 
    duration:500 
}); 

//-- Changes the crust type label text when the user scrolls 
scrollView.addEventListener('scroll',function(){ 
    crustType.text = crusts[scrollView.currentPage].title; 
}); 

다음은 결과 스크린 샷입니다. 실제 결과와

이미지 : 원하는 결과 https://www.dropbox.com/s/m58pvx2dvde2xy7/actual%20result.png?dl=0

이미지 : https://www.dropbox.com/s/dslr4ilgo8ro9yf/desired.jpg?dl=0

내가 잘못 무엇입니까 어디 있는지 말해주십시오. 감사합니다. .

답변

0

../images/XXX과 같은 경로로 이미지를 참조 할 수 없습니다. /images은 그래픽 리소스의 루트 폴더로 간주됩니다.

는 윈도우 내가이 시도 한 배경

win.backgroundImage = '/images/bg_main.png'; 
+0

하지만 동일한 오류로 경로를 변경하려고합니다. –