When I launch the iPhone app on the iPad, the screen resolution is incorrect. How to fix it?

I ran into a strange problem. I am developing an application targeted at the iPhone device family with Retina 3.5 and 4. All the time I used the iPhone 5 simulator to test the entire user interface and functionality, and everything was fine, but I know that I should test push notifications. I have an iPad 4 (model MD522ZP / A) as an iOS 6 device. When I run my application on it, all the user interface layouts become wrong. The strangest problem is when I tried to check the screen resolution with this code:

NSLog(@"RESOLUTION = %@", NSStringFromCGSize([UIScreen mainScreen].bounds.size)); 

I got the following: RESOLUTION = {320, 480} . But this is the resolution of the iPhone 3! Why didn't the iPad use Retina 3.5 / 4 resolution? And how can I fix this? I don’t want to create separate xibs just for testing the iPad, but I want to test it on it so that all user interface elements fit on the screen.

We hope for help.

+4
source share
1 answer

This is not true. He does exactly what he needs. All dimension references are in points, not pixels. When you get the borders, it will be 320x480 on all 3.5-inch screens, whether it’s a retina or not. Try on any 3.5-inch retina device. You will get the same log result.

iPad does not imitate a 4-inch device when working with an iPhone application. It will always support iPhone iPhone 3.5 compatible.

Thus, the view 320x480 is the right size.

Think of it this way. The Retina iPad will feature an iPhone app similar to working with a 3.5-inch mesh iPhone. The non-retina iPad will show the iPhone app as if it were running on a 3.5-inch non-mesh iPhone.

+13
source

Source: https://habr.com/ru/post/1495220/


All Articles