2013-04-28 3 views
3

크로스 플랫폼 Titanium SDK 및 Alloy MVC 프레임 워크에 익숙하지 않습니다. 제목을 표시 할 때 아이폰의 "나"를 클릭하고 제목 "제출"을 표시하는 방법을 알고Titaninum Appcelerator에서 iPhone과 iPad를 구분하십시오

<Alloy> 
    <Button id="button">Click Me</Button> 
</Alloy> 

하지만 지금 내가 원하는을 :

나는이 같은이 Index.xml 내부에 버튼을 생성 iPad에서.

어디에서 조건을 작성해야합니까? index.xml, index.js 또는 index.tss?

답변

7

당신도이 같은이 Index.xml 파일에, 그것을 몇 가지 방법을 수행 할 수 있습니다

if(Alloy.isHandheld) { 
    $.button.title = "Click Me"; 
} 

if(Alloy.isTablet) { 
    $.button.title = "Submit"; 
} 

또는 스타일 파일 :

<Alloy> 
    <Button formFactor="handheld" id="button">Click Me</Button> 
    <Button formFactor="tablet" id="button">Submit</Button> 
</Alloy> 

또는이 같이하는 index.js에서

, index.tss like :

"#button[formFactor=handheld]" : { 
    title : "Click Me" 
}, 

"#button[formFactor=tablet]" : { 
    title : "Submit" 
} 
+0

고마워요. 많이 도와 줬어. – SSS

관련 문제