[AC-2457] Ti.Platform.displayCaps.platformWidth gives the wrong value when default points pixels
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2013-01-02T20:07:12.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | Oleg Polyakov |
| Assignee | Daniel Sefton |
| Created | 2012-12-21T18:22:35.000+0000 |
| Updated | 2016-03-08T07:41:30.000+0000 |
Description
If you change the position (left) of parent View the child views will start shrinking. I have been told to use //$.container.width=Ti.Platform.displayCaps.platformWidth;
However, Ti.Platform.displayCaps.platformWidth gives me 320 on retina display. I need 640 for this to work. I am using everything in pixels as I defined in tiapp.xml
Why cannot platformWidth give me 640 which is the true width in pixels? Is it a bug?
platformWidth/Height returns the display units. Here's how to convert those to pixels:
Closing as invalid.function DPUnitsToPixels(TheDPUnits) { return (TheDPUnits * (Titanium.Platform.displayCaps.dpi / 160)); } // If platformWidth is 320, it converts it to 640 DPUnitsToPixels(Titanium.Platform.DisplayCaps.platformWidth);