LoginSignup
4
4

More than 5 years have passed since last update.

TitaniumでiPhone 6を判定する

Last updated at Posted at 2014-10-06

iPhone6, 6plusが出たことでiPhone向けでもViewを切り替えなければならないケースが出てきました。今のところplatformHeightで判断して切り替えるようにしています。

alloy.js
var platformHeight = Ti.Platform.displayCaps.platformHeight;
Alloy.Globals.isIPhone6Plus = platformHeight === 736;
Alloy.Globals.isIPhone6 = platformHeight === 667;
Alloy.Globals.isIPhone5 = platformHeight <= 568;
app.tss
"Label[if=Alloy.Globals.isIPhone6Plus]": {
    text: "iPhone 6 Plus"
}

"Label[if=Alloy.Globals.isIPhone6]": {
    text: "iPhone 6"
}

"Label[if=Alloy.Globals.isIPhone5]": {
    text: "iPhone 5 or earlier"
}

この方法でまずいケースがあれば是非教えてください!

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4