Re: iOS screen physical size (or px density)
Re: iOS screen physical size (or px density)
- Subject: Re: iOS screen physical size (or px density)
- From: Maxthon Chan <email@hidden>
- Date: Tue, 26 Nov 2013 21:36:41 +0800
There is not any known public API for that. You can use the device type reading as a default and offer user an calibration option.
On Nov 26, 2013, at 21:34, Roland King <email@hidden> wrote:
> No I clearly said in my very first message
>
> "I know there was lots of chat about this when the mini came out, there wasn't anything then and I don't want to do one of the version or device name hacks. Is there yet an API point for this? "
>
> If there isn't a proper API point for it, then I'm not doing it.
>
> On 26 Nov, 2013, at 9:20 pm, Maxthon Chan <email@hidden> wrote:
>
>> Well you just need to detect the device and the numbers are constant:
>>
>> Screen information:
>>
>> iPhone 2G/3G/3GS, iPod touch 1G/2G/3G: 320x480px, 163dpi
>> iPad mini 1G: 1024x768px, 163dpi
>>
>> iPhone 4/4S, iPod touch 4G: 640x960px, 326dpi
>> iPhone 5/5C/5S, iPod touch 5G: 640x1136px, 326dpi
>> iPad mini 2G: 2048x1536px, 326dpi
>>
>> iPad 1G/2: 1024x768px, 132dpi
>> iPad 3G/4G/Air: 2048x1536px, 264dpi
>>
>> Device model identifier (readable from uname(2)):
>>
>> iPhone1,1 = iPhone 2G
>> iPhone1,2 = iPhone 3G
>> iPhone2,1 = iPhone 3GS
>> iPhone3,* = iPhone 4
>> iPhone4,1 = iPhone 4S
>> iPhone5,{1..3} = iPhone 5
>> iPhone5,{4..6} = iPhone 5C
>> iPhone6,* = iPhone 5S
>>
>> iPod1,1 = iPod touch 1G
>> iPod2,1 = iPod touch 2G
>> iPod3,1 = iPod touch 3G
>> iPod4,1 = iPod touch 4G
>> iPod5,1 = iPod touch 5G
>>
>> iPad1,1 = iPad 1G
>> iPad2,{1..4} = iPad 2
>> iPad2,{5..7} = iPad mini 1G
>> iPad3,{1..3} = iPad 3G
>> iPad3,{4..6} = iPad 4G
>> iPad4,{1..3} = iPad Air
>> iPad4,{4..6} = iPad mini 2G
>>
>> On Nov 26, 2013, at 16:57, Roland King <email@hidden> wrote:
>>
>>> no that just gives you the total number of pixels on the screen, I know that, that's not a problem.
>>>
>>> That is not the screen physical size (ie X cm x Y cm) and you can't figure out if you want something to be a given physical size, which I did, how many points it should be. In order to know the physical screen size you would need an API point which either returns it directly, or returns the pixel density in px/cm.
>>>
>>> Anyway I went with the suggestion of an earlier poster and scaled up so it was nearly as big as I wanted on the mini, and bigger than I really wanted on the iPad, both using the same pointsize for the elements. And that's not a bad compromise (in fact on the larger iPad the bigger test cards are very clear and you don't really notice they are .. a bit huge). Problem solved, one interface for either of the two sizes of iPad, and the iPhone was never a problem.
>>>
>>> I still would like that API point, I shall file a bug which will be duped.
>>>
>>> On 26 Nov, 2013, at 4:18 pm, Jacky.Seraph Mu <email@hidden> wrote:
>>>
>>>> Maybe you can refer to
>>>> [UIScreen mainScreen].scale and [UIScreen mainScreen].bounds
>>>>
>>>> The scale tells you the pixels per point.
>>>> The bounds provides you the whole screen size in point.
>>>>
>>>> To get the real size per pixel:
>>>> scale * bounds
>>>>
>>>>
>>>> Cheers
>>>>
>>>> Jack.S Mu
>>>>
>>>>
>>>>
>>>> 2013/11/25 Roland King <email@hidden>
>>>> Is there yet a supported way of finding out the actual screen size (or equivalently pixel density) on an iOS screen?
>>>>
>>>> I have an app, uses autolayout, works fine on iPhone (one storyboard), iPad (another storyboard) and mostly looks fine between iPad and iPad mini. One screen however has a number of test 'cards' on it. On the phone one card == one screen looks great. On a full-sized iPad, about 6 to a page is clear, on a mini however 6 is not ideal and 4, or 3, looks much better and is much clearer to test. That's one of the fairly rare cases where one size doesn't fit all and knowing the actual screen dimensions would make a better user experience.
>>>>
>>>> I know there was lots of chat about this when the mini came out, there wasn't anything then and I don't want to do one of the version or device name hacks. Is there yet an API point for this?
>>>> _______________________________________________
>>>>
>>>> Cocoa-dev mailing list (email@hidden)
>>>>
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>>
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden