简体   繁体   中英

Getting Wrong Screen Sizes in iPhone 6/6+

I am getting wrong screen size in iPhone 6 and 6+ by using

[UIScreen mainScreen].nativeBounds

and

[UIScreen mainScreen].bounds

In both case , i am getting wrong screen size.

So, I have added launch screen for iPhone 6 and iPhone 6+ then I get correct size of screen in iPhone 6 and iPhone 6+.

But another problem is that My App UI displaying wrong. All Screens of app left right padding. See below image :

在此处输入图片说明

If I remove launch screen for iPhone 6 and 6+ then App UI is displaying right as displaying before like below image :

在此处输入图片说明

In above image, no right padding.

I have also check by adding launch screen but that also getting wrong screen sizes.

Note : I have used AutoResize in app and It is working good in whole app.

I have also do so much googling to find out actual problem but unfortunately can't get it. Thanks so much in advance If anyone help to sort out that problem.

抱歉,您是否检查了设置->显示和亮度->视图(标准)?

One of the possible patch to identify your screen type is by getting the scale of your screen. You can use the following code : [UIScreen mainScreen].scale;

This will not let you know the exact screen size but will allow you to know what is the scaling. This method might be helpful where you need not to code individually for different screens and majorly do not want to convert your entire code to autolayout.

To know the scaling factor of different screens refer to following link : http://www.paintcodeapp.com/news/iphone-6-screens-demystified

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM