0 Replies Latest reply on Apr 12, 2013 3:23 PM by reds72

    How can I set an images height/width to display in inches for an iOS app?

    reds72

      I am currently attempting to return the name of the device, then manually assigning a DPI.  I am then multiplying that DPI times the number of inches that the image will display at.  Here are the two functions used to determine the device and set the DPI:

       

      function getDevice():String {

                var devFinal:String;

                var devStr:String = Capabilities.os;

                var devStrArr:Array = devStr.split(" ");

                devStr = devStrArr.pop();

                devStr = (devStr.indexOf(",") > -1)?devStr.split(",").shift():debuggerDevice;

       

                if ((devStr == "iPad1") || (devStr == "iPad2")){

                                              devFinal = "ipad";

                                    } else if ((devStr == "iPad3") || (devStr == "iPad4")){

                                              devFinal = "ipad3";

                                    } else {

                                              //This will be the iPad Mini

                                              devFinal = "ipadmini";

                                    }

                                    return devFinal;

      }

       

      function getDPI():int {

                var retDPI:int;

                if (currentDevice == "ipad"){

                          retDPI = 132;

                }

                else if (currentDevice == "ipad3"){

                          retDPI = 264;

                }

                else if (currentDevice == "ipadmini"){

                          retDPI = 163;

                }

                else {

                          retDPI = 132;

                }

                return retDPI;

      }