2016-03-15 59 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)。請讓我知道我能做到這一點。 –