2015-04-22 65 views
1

這是我的問題。我有這個故事板:storyboard 第一個容器必須有一個固定的高度。它與帶有開關的DetailFormViewController有關。我不希望它是可滾動的。容器視圖設置高度取決於孩子

第二個容器必須具有動態高度,即採取可用高度。它會顯示uitableview。

這裏我在iPhone 6上有:iphone 6和iPhone 5S:iphone 5S

我有3個問題:

  1. 爲什麼會出現在DetailFormViewController的tableView的頂部的空白?
  2. 我該如何刪除它並且我能達到目標?
  3. 您是否認爲我放置的佈局是實現我想要的最佳方式(基於iPhone 6屏幕截圖)?

謝謝你的所有答案。

+0

你在IB有adjustScrollViewInsets嗎? –

回答

2

用於使頂部容器高度固定並且底部容器是柔性的。要僅保留頂部容器中的4行,請將頂部容器高度約束值設置爲等於4單元高度(4 *單元高度)。

您需要在兩個容器添加約束像如下:

我已經命名爲頂櫃查看和底部容器查看第二容器第一容器。

Top Container View constraints: 
    - Top Space to Top Layout Guide 
    - Leading Space to container 
    - Trailing Space to container 
    - Vertical Space to Bottom Container View 
    - Height 

    Bottom Container View constraints: 
    - Bottom Space to Bottom Layout Guide 
    - Leading Space to container 
    - Trailing Space to container 

約束在該圖中提到: Constraints on Container views

設置在頂部容器視圖的高度定義了俯視的高度是固定的,在底部容器觀的高度變得靈活。

iPhone 4S人像:

iPhone 4S Portrait Layout with above set constraints

iPhone 4S景觀: iPhone 4S Landscape layout with same constraints

iPhone 5S人像:

iPhone 5S Portrait layout with same constraints

iPhone 5S景觀: iPhone 5S Landscape layout with same constraints

0

很可能您在視圖控制器中啓用了Adjust Scroll View Insets。

enter image description here

0

解決問題,以創建一個新的。

這裏是我現在有:

iPhone 5S:iphone 5S

iphone 6:iphone 6

是否有可能有中庸之道兩行所有設備?我必須以編程方式進行嗎?

相關問題