当我在iPad上运行iPhone应用程序时,屏幕分辨率是错误的。如何解决这个问题? [英] When I run iPhone app on iPad the screen resolution is wrong. How to fix this?

查看:1163
本文介绍了当我在iPad上运行iPhone应用程序时,屏幕分辨率是错误的。如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题。我开发了一个应用程序,目标是iPhone设备家族与Retina 3.5和4。所有的时间,我使用iPhone 5模拟器测试所有的UI和功能,一切都很好,但知道我必须测试推送通知。我有iPad 4(型号MD522ZP / A)作为iOS 6设备。当我运行我的应用程序上的所有UI布局都错了。最奇怪的问题是当我尝试使用此代码检查显示分辨率:

I encountered with a strange problem. I develop an application which is targeting iPhone device family with Retina 3.5 and 4. All the time I used iPhone 5 simulator to test all the UI and functionality and everything was good but know I have to test push notifications. I have iPad 4 (model MD522ZP/A) as an iOS 6 device. When I run my app on it all the UI layout became wrong. The most weird problem is when I tried to check display resolution with this code:

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

我得到这个: RESOLUTION = {320,480} 。但它是iPhone 3的分辨率!为什么iPad没有使用Retina 3.5 / 4分辨率?我该如何解决呢?我不想为iPad测试创建单独的 xibs ,但我想测试我的应用程序,以便所有的UI元素将适合在屏幕上。

希望获得帮助。

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

Hope for the help.

推荐答案

它正在做正确的事情。所有对大小的引用都是点而不是像素。当你得到边界,它将是320x480在所有3.5的屏幕,无论他们是否视网膜,试试在任何3.5视网膜设备。

It's not wrong. It is doing exactly the right thing. All references to sizes are in points, not pixels. When you get the bounds, it will be 320x480 on all 3.5" screens whether they are retina or not. Try it on any 3.5" retina device. You will get the same log output.

运行仅iPhone应用程序时,iPad不会模拟4设备,它将始终是3.5iPhone兼容模式。

The iPad does not emulate a 4" device when running an iPhone-only app. It will always be a 3.5" iPhone compatible mode.

所以看到320x480是正确的大小。

So seeing 320x480 is the correct size to expect.

这样想。视网膜iPad将显示一个只有iPhone的应用程序,它运行在3.5视网膜iPhone上。非视网膜iPad将显示一个仅iPhone应用程序,它运行在3.5非视网膜iPhone上。

Think of it this way. A retina iPad will show an iPhone-only app like it is running on a 3.5" retina iPhone. A non-retina iPad will show an iPhone-only app like it is running on a 3.5" non-retina iPhone.

这篇关于当我在iPad上运行iPhone应用程序时,屏幕分辨率是错误的。如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆