如何处理iPhone 4s,5和6的屏幕尺寸,以及如何使所有内容在所有设备上看起来都相同 [英] How to handle iPhone 4s, 5 and 6 screen size, and make all the contents look the same across al the devices

查看:87
本文介绍了如何处理iPhone 4s,5和6的屏幕尺寸,以及如何使所有内容在所有设备上看起来都相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode 6.1,在我所拥有的视图之一中,它包含许多标签.但是,这些标签在每个不同的设备中看起来都不同.尽管我对所有标签都添加了约束,但是仍然面临着同样的问题.

I am using Xcode 6.1 and in one of the views I have, contains many labels. However, these labels look different in each different devices. Although I have add constraints to all the labels, but still facing the same issue.

如何在所有设备上获得相同的视图布局? 如何使每个标签的宽度和高度灵活,取决于屏幕尺寸? 我需要为每个设备设计不同的xib吗?

How can I get the same view layout across all devices? How can I make the width and height for each label is flexible, depends on the screen size? Do I need to design different xib for each device?

以下显示结果的图像,启用了自动调整大小,并添加了常量.

The following images showing the result am getting, with auto resize enabled, and constants been added.

在iPhone 5上

推荐答案

我们提供了一个简单的解决方案.使用纵横比约束,我们可以在所有设备屏幕上获得相对的外观.

We have provided with a simple solution . Using Aspect ratio constraint we can get a relative look in all device screens.

我遇到了同样的问题,我发现了这个>> http://mathewsanders.com/designing-adaptive-layouts-for- iphone-6-plus/

I had the same issue and I found this >> http://mathewsanders.com/designing-adaptive-layouts-for-iphone-6-plus/

因此,当设计从最低到最高的屏幕分辨率时,我们不能为所有控件设置特定的宽度和高度,因为它看起来很奇怪.因此,使用此约束,我们可以对所有屏幕进行相对查看.

So when designing for lowest to highest screen resolution we can't set a specific width and height for all controls as it may look weird. So using this constraint we can have a relative look for all screens.

如果您不想使用约束或想要保持相同的宽度& height,您可以添加scrollview来容纳所有控件.为此,您可以为滚动视图设置具有固定内容大小的调整大小框架.

If you don't want to use constraints or you want to keep the same width & height , you can add scrollview to hold all controls. For that you can set a resizing frame for scrollview with fixed content size .

这篇关于如何处理iPhone 4s,5和6的屏幕尺寸,以及如何使所有内容在所有设备上看起来都相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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