2016-03-15 34 views
2

我正在研究具有所有方向支持的通用应用程序。我也跟着下面的步骤Swift 2.0中的尺寸类别无法正常工作

  1. 选择width compact & height any尺寸级别,见下图:

enter image description here

至于我能理解上面的图片介绍,如果我们想设计布局iPhone- 4到iPhone-6比我们应该使用width compact & height any大小类。

在使用width compact & height any I类放约束像下面的图像中 enter image description here

  • 选择width compact & height regular尺寸类,见下文:
  • enter image description here

    这对我来说有点令人困惑,所以我所做的只是考虑width compact & height regular尺寸等级仅适用于iPhone-6 Plus。

    在使用width compact & height regular大小I类放约束相同我把用于width compact & height any尺寸类,但改变约束的值,请参见下面的图像

    enter image description here

    在上述图像中看看右侧的红色框,我已经为三种尺寸类别的heightwidth约束添加了多个值width compact & height anywidth compact & height regularwidth regular & height regular

    我与尺寸类问题:当我从iPhone-4上运行的模拟器或设备应用到iPhone-6中,示出了UIImageViewheightwidth我分配给width compact & height regular即250,在那里它必须显示UIImageViewheightwidth我分配到width compact & height any即200

    虽然在iPhone上-6 Plus或iPad上它显示CORRE运行的应用程序我为他们分配的编号为heightwidth

    查询:我怎么能实现不同尺寸不同的iPhone类似的UIImageView等控制器对象?

    回答

    1

    肖像中的所有iPhone模型都具有相同的性状RH-CW。 您试图实现的功能将无法正常工作,因为any将转换为regular,因此常规将优先于any

    肖像中,iPhone 6 Plus使用紧凑的水平和常规的 垂直大小类。

    在纵向,iPhone 6,iPhone 5和iPhone 4s使用紧凑的 水平和常规垂直大小类。

    +0

    我没有给你,什么是_compact horizo​​ntal_和_regular vertical_?你的意思是_compact width_和_regular height_? –

    +0

    @VijaySanghavi是的,这是他们如何在HIG文档中调用它们https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/MobileHIG/LayoutandAppearance.html – Andrea

    +0

    如何实现控制器对象,如'UIImageView '在不同尺寸的不同iPhone上?正如你所说的,横向和垂直的垂直_适用于所有类型的iPhone(iPhone4到iPhone6和iPhone6 Plus)。请让我知道我能做到这一点。 –

    相关问题