Isaac Paul
Isaac Paul

Reputation: 1977

[UIScreen mainScreen].scale always returns 2 for Non-Retina iPads

Using xcode 5.1.1 with ios 7.1 to build a iPhone only app.

When running this app on any non-retina device (ipad mini, simulator, ipad 2), [UIScreen mainScreen].scale always returns 2 leaving me with no way to detect if I'm on a retina screen.

This is contrary to all the other posts on checking for retina (Detect Retina Display)

Does anyone have an alternative method besides checking against a list of hard coded devices?

Upvotes: 2

Views: 3804

Answers (1)

Isaac Paul
Isaac Paul

Reputation: 1977

It seems the only way is to check the platform identifiers.

I've implemented it here: https://gist.github.com/izackp/2ee0ca4b6c731b254e55

However, it is not accurate on the simulator since I don't get a unique id based on the simulator used, and it will not work for future devices that use retina resources and have a non-retina display.

Upvotes: 3

Related Questions