2015-10-14 28 views
0

我必須使用什麼元素才能實現圖像中的iOS應用程序? A,B和C塊應像一個大元素一樣滾動。我的意思是沒有固定位置元素。iOS。如何從故事板中的圖像進行佈局?

我試着這樣說: 答:與UIView的子樹UIViews B:UICollectionView C:也許UIView的,但這C地塊應該再出現在滾動,直到結束。 所有A,B,C塊我放在UIScrollView下,但塊不滾動。

app design

+0

在您的sotryboard中顯示您的視圖hierrachy –

回答

0

爲了讓段C出現在您的收藏視圖結束時,您可以添加該段集合視圖的頁腳視圖。使用下面的方法UICollectionViewDataSource實現這一目標:

override func collectionView(collectionView: UICollectionView, 
    viewForSupplementaryElementOfKind kind: String, 
    atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { 
    switch kind { 
     case UICollectionElementKindSectionFooter: 
     // Create and return an instance your footer view here 
     default: 
     assert(false, "Unexpected element kind") 
    } 
} 

然後轉到您的故事板,選擇您的收藏視圖,轉到屬性檢查器,然後選中「頁腳節」附件下。

您無法滾動段A的可能原因是您沒有相應地調整滾動視圖的內容大小。如果是這種情況,請嘗試this solution