Last active
August 29, 2015 14:10
-
-
Save nishiyamaosamu/5f8f22d8498cb3ef79a7 to your computer and use it in GitHub Desktop.
SwiftでiPhoneとiPadを判別する ref: http://qiita.com/osamu1203/items/f45909bdffcf6373f4b6
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
enum UIUserInterfaceIdiom : Int { | |
case Unspecified | |
case Phone // iPhone and iPod | |
case Pad // iPad | |
} |
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
if UIDevice.currentDevice().userInterfaceIdiom == .Phone { | |
println("iPhone") | |
}else if UIDevice.currentDevice().userInterfaceIdiom == .Pad{ | |
println("iPad") | |
}else{ | |
println("Unspecified") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment