Skip to content

Instantly share code, notes, and snippets.

@nishiyamaosamu
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nishiyamaosamu/5f8f22d8498cb3ef79a7 to your computer and use it in GitHub Desktop.
Save nishiyamaosamu/5f8f22d8498cb3ef79a7 to your computer and use it in GitHub Desktop.
SwiftでiPhoneとiPadを判別する ref: http://qiita.com/osamu1203/items/f45909bdffcf6373f4b6
enum UIUserInterfaceIdiom : Int {
case Unspecified
case Phone // iPhone and iPod
case Pad // iPad
}
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