문제

I have a 1st generation iPad Mini (Model A1432) with a screen resolution of 1024x768 (documentation).

I have the following code in my app:

CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGFloat screenScale = [[UIScreen mainScreen] scale];
CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale);

screenSize.height and screenSize.width report: 2048x1536, which is wrong. The screenScale value is 2, but it is my understanding that it should only be 2 for retina screens, which the 1st generation iPad Mini is not.

Any ideas why this might be happening? I'm trying to have code in my app that determines the screen resolution at runtime, as I am doing pixel manipulation for an augmented reality app.

Many thanks for any help.

도움이 되었습니까?

해결책

After a discussion in comments...!

If you run an iPhone only app on an iPad it will simulate a retina device and report a scale of 2.0. We know (from the above!) that the iPad mini (gen 1) does this as well as the standard iPad 2 running iOS 7 would too.

This was introduced in iOS 7.

Nice gotcha to watch out for!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top