【发布时间】:2024-05-20 02:00:01
【问题描述】:
我使用的是钛合金框架,问题是我根据iphone 5设置了尺寸参数。当我为iphone 4编译时,UI出现了某种干扰。
简而言之,我想要在 iphone 4 和 5 中处理钛合金中 .tss 和 .xml 文件中不同屏幕分辨率的方法。
【问题讨论】:
标签: ios iphone titanium titanium-alloy
我使用的是钛合金框架,问题是我根据iphone 5设置了尺寸参数。当我为iphone 4编译时,UI出现了某种干扰。
简而言之,我想要在 iphone 4 和 5 中处理钛合金中 .tss 和 .xml 文件中不同屏幕分辨率的方法。
【问题讨论】:
标签: ios iphone titanium titanium-alloy
您可以尝试根据以下链接设置条件。
您可以使用自己的布尔全局变量代替 Alloy.Globals.isIOS7,来检查它是 iphone 4 还是 5。
【讨论】:
@Mitul Bhalia 是正确的。
1.检测具体屏幕分辨率:
// app/alloy.js
Alloy.Globals.isIos7Plus = (OS_IOS && parseInt(Ti.Platform.version.split(".")[0]) >= 7);
Alloy.Globals.iPhoneTall = (OS_IOS && Ti.Platform.osname == "iphone" && Ti.Platform.displayCaps.platformHeight == 568);
2.编写查询样式tss:
// Query styles
"#info[if=Alloy.Globals.isIos7Plus]" : {
font : { textStyle : Ti.UI.TEXT_STYLE_FOOTNOTE }
},
"#title[if=Alloy.Globals.isIos7Plus]" : {
top: '25dp', // compensate for the status bar on iOS 7
font : { textStyle : Ti.UI.TEXT_STYLE_HEADLINE }
},
"#content[if=Alloy.Globals.isIos7Plus]" : {
font : { textStyle : Ti.UI.TEXT_STYLE_CAPTION1 }
},
"ScrollView[if=Alloy.Globals.iPhoneTall]" : {
height : '500dp'
}
【讨论】: