In the ideal world, you would scale your content to work on an arbitrarily
sized UIView and not worry about actual screen dimensions/density. From my
experience, this pays off most in the long run, especially when new
devices come out. This involves designing your app so it doesn't use fixed
size bitmap images and working toward a design with vector drawing art, or
using stretching versions of image artwork. See here for example:

-[UIImage resizableImageWithCapInsets:]

There was a really great session from a recent WWDC that covered
appearance customization. It's the best way to learn how to design your
app to use custom artwork correctly and should be required viewing for iOS
developers. Unfortunately, I can't discuss this on a public forum due to
Apple restrictions on "confidential information" but registered Apple
developers can email me for more info.

Again, your time is best spent following best practices before trying to
use specifics of an output screen.
That said, here are some pointers to getting the actual size of the
displays that your device is being output:

-[UIScreen currentMode]
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScreen_Class/Reference/UIScreen.html#//apple_ref/occ/instp/UIScreen/currentMode

-[UIScreenMode size]
-[UIScreenMode pixelAspectRatio]
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScreenMode_class/Reference/Reference.html#//apple_ref/occ/instp/UIScreenMode/

Good luck!

Doug Hill

On Mon, November 25, 2013 4:40 am, Roland King wrote:
> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to