Created
August 21, 2012 09:07
-
-
Save setou/3413781 to your computer and use it in GitHub Desktop.
Titanium Mobileで作ったアプリを横向きに対応させる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Titanium Mobile のView配置を横向きに対応させる | |
* tiapp.xmlに以下を追加してください。※追加後はProjectのCleanを忘れずに。 | |
* <iphone> | |
* <orientations device="iphone"> | |
* <orientation>Ti.UI.PORTRAIT</orientation> | |
* <orientation>Ti.UI.LANDSCAPE_LEFT</orientation> | |
* <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation> | |
* </orientations> | |
* </iphone> | |
*/ | |
if (Ti.version < 2.0 ) { | |
alert('Sorry - this application requires Titanium Mobile SDK 2.0 or later'); | |
} | |
var win = Ti.UI.createWindow(); | |
var topLeftView = Ti.UI.createView({ | |
top : 0, | |
left : 0, | |
height : '50%', | |
width : '33%', | |
backgroundColor : 'blue', | |
}); | |
win.add(topLeftView); | |
var topCenterView = Ti.UI.createView({ | |
top : 0, | |
left : '33%', | |
right : '33%', | |
height : '50%', | |
width : Ti.UI.FILL, | |
backgroundColor : 'yellow', | |
}); | |
win.add(topCenterView); | |
var topRightView = Ti.UI.createView({ | |
top : 0, | |
right : 0, | |
height : '50%', | |
width : '33%', | |
backgroundColor : 'red', | |
}); | |
win.add(topRightView); | |
var bottomLeftView = Ti.UI.createView({ | |
top : '50%', | |
left : 0, | |
height : '50%', | |
width : '33%', | |
backgroundColor : 'navy', | |
}); | |
win.add(bottomLeftView); | |
var bottomCenterView = Ti.UI.createView({ | |
top : '50%', | |
left : '33%', | |
right : '33%', | |
height : '50%', | |
width : Ti.UI.FILL, | |
backgroundColor : 'orange', | |
}); | |
win.add(bottomCenterView); | |
var bottomRightView = Ti.UI.createView({ | |
top : '50%', | |
right : 0, | |
height : '50%', | |
width : '33%', | |
backgroundColor : 'pink', | |
}); | |
win.add(bottomRightView); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment