iOS版。如何从故事板中的图像进行布局?

时间:2015-10-14 16:36:27

标签: ios objective-c layout uiview uiscrollview

我必须使用哪些元素来实现图片中的iOS应用? A,B和C块应该像一个大元素一样滚动。我的意思是没有固定的位置元素。

我试过这种方式: 答:UIView与树子UIViews B:UICollectionView C:也许UIView,但是应该出现这个C块,然后滚动直到结束。 我放在UIScrollView下的所有A,B,C块,但是一个块不会滚动。

app design

1 个答案:

答案 0 :(得分: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