User Tag List

Results 1 to 5 of 5

Thread: TRICK: Detect iPad vs iPhone/iPod Touch?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module
    Javira's Avatar
    Join Date
    Mar 2012
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    TRICK: Detect iPad vs iPhone/iPod Touch?

    I use the iOS Get Device for disabling features on low end devices, but what if you want to simply detect if you are on an iPad or an iPhone/iPod Touch, even for future devices.

    Maybe there is another way of doing this, but this is really simple.

    Step 1
    Include window control object.

    Detect iPad:
    Run this event once
    ScreenXSize(WindowControlObject)>640

    Detect iPhone/iPod:
    Run this event once
    TouchScreenXSize(WindowControlObject)<640

    This works even when you stretch your app to fill canvas. On iPhones and iPod Touch the ScreenXSize returns 320, and on iPad 768 for some reason. I feel safe doing this as I have testet it on iPad 1st gen, iPad 2nd gen, iPad 4, iPod Touch 4th gen and iPhone 4. But I would like to hear results on 5th gen devices? Please share.

    But why??
    I am making an app with edit boxes, but unfortunately text is rendered differently on iPad vs iPhone. So to control the font size I use the trick above.

    Note:
    Run this event once is really important, or you will get very low performance. You can of course use any other number between 320 and 768, I just expected it to return 640.

  2. #2
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Pineapple's Avatar
    Join Date
    Oct 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might try using the "storyboard controls"

    Set aside 4 global or alterable values
    Always: set alt val A to x coordinate of left visible edge, set alt val B to x coordinate of right visible edge, set alt val C to y coordinate of top visible edge, set alt val D to y coordinate of bottom visible edge.

    Then compare those values to get the screen size.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module
    Javira's Avatar
    Join Date
    Mar 2012
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but it doesn't work if you have set your app to stretch to fill.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    SoftWarewolf's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    926
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I haven't thought about using window control on ios, most functions wouldn't work.. what you say means window control get sizes in portrait mode, it doesn't change on landscape apps?
    On iphone retina, the xsize should return 640, so i would just use <700 or >700, since ipad is 768 or 1536.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jan 2010
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,
    This is great for HTML5 too as far as I can tell!

Similar Threads

  1. Universal resolution of the screen for iphone, ipad n ipod.
    By Decoamorim in forum iOS Export Module Version 2.0
    Replies: 3
    Last Post: 29th May 2013, 07:37 AM
  2. Super Smoothie 2! Universal app for iPhone, iPod Touch and iPad
    By leuvsion in forum iOS Released Games & Apps
    Replies: 0
    Last Post: 15th February 2013, 09:40 PM
  3. Fortitude! New game for iPhone, iPod Touch and iPad.
    By Pineapple in forum iOS Released Games & Apps
    Replies: 10
    Last Post: 1st January 2013, 11:08 PM
  4. ipod Touch/ iPhone Applications
    By legocacher in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 25th July 2010, 04:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •