Answering the question as asked about the size of pixels:
Pixel size on an iPhone and iPod Touch
The earlier iPhones (pre-iPhone 4) Apple iPhone Technical Specifications said : 480-by-320-pixel resolution at 163 pixels per inch(ppi). About 0.006135 inches per pixel or 0.1558282 mm per pixel.
The first three iPod touch generations stated the same 163 ppi.
The iPhone 4 specs said 960-by-640-pixel resolution at 326 ppi . So pixel width is 1 inch / 326 pixels per inch or about 0.003067 inches per pixel or 0.0779 mm per pixel. You use points, not pixels. Edit: As noted in Olaf's comment, below, pixels are actually addressable, using half-points.
The fourth generation iPod touch (Sept 2010) has
specs the same as the iPhone 4, 960-by-640-pixel resolution at 326 ppi
The iPhone 4S (Oct 2011) is unchanged from the iPhone 4 in terms of resolution.
The iPhone 5 (Sept 2012) specs said 1136-by-640 pixel resolution at 326 ppi. Pixel size is unchanged. Screen diagonal is 4 inches.
The iPhone 5C and iPhone 5S (Sept 2013) have the same resolution, pixel size, and diagonal as the iPhone 5.
The iPhone 6, 4.7 inch, (Sept 2014)
specs are 1334-by-750-pixel resolution,
at 326 pixels per inch (ppi). pixel size is unchanged from 4, 4S, 5 5s.
The iPhone 6 Plus, 5.5 inch, (Sept 2014)
specs are 1920-by-1080-pixel resolution,
at 401 pixels per inch (ppi). pixel size is about 20% smaller. The pixel width is 1 inch / 401 pixels per inch or about 0.002494 inches per pixel or 0.06334 mm per pixel.
Pixel size on an iPad
- The iPad 1 and 2 are 9.7 inch (diagonal) display with 1024-by-768-pixel resolution at 132 ppi per the iPad specs. That is about .0075758 inches per pixel or 0.1924 mm per pixel.
-
The new iPad (March 2012) is a 9.7 inch (diagonal) display with 2048-by-1536-pixel resolution at 264 ppi
per the current iPad specs.
That is about .0037879 inches per pixel or 0.09621 mm per pixel.
- The iPad Mini (1st generation - October 2012) is a 7.9 inch (diagonal) display with a 1024-by-768-pixel resolution at 163 ppi per the original iPad mini specs. That is about
.006135 inches per pixel or 0.156 mm per pixel.
-
The iPad Mini 2 (2nd generation - October 2013) is a 7.9 inch (diagonal) display with a 2048-by-1536-pixel resolution at 326 ppi per the current iPad mini specs. That is about
.0030675 inches per pixel or 0.0779 mm per pixel.
-
The iPad Air 2 (October 2014) and the iPad Mini 3 (October 2014) have the same resolution, pixel size, and diagonal as the previous versions of those products.
Comparison of the iPad Air, and iPad Air 2, iPad Mini, iPad 2 and iPad3.
You don't need to have the iPhone SDK calculate the size of a single pixel. One option is to determine what you are running on and then select the needed mm size.
The iPhone (up to and including the 4S) / iPod Touch screen sizes, with a 3.5 inch (diagonal) display are NOT exactly 2" x 3". They are a tiny bit smaller than that. The iPhone 5 has a 4 inch (diagonal) display.
What the questioner may actually need: points.
See Removers comment to the previous answer. Coordinates are specified in points, not pixels.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…