【问题标题】:iOS. how to make layout from image in the storyboard?IOS。如何从情节提要中的图像进行布局?
【发布时间】:2015-10-14 16:36:27
【问题描述】:

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

我试过这样: A:带有树子 UIViews 的 UIView B:UICollectionView C:也许是 UIView,但是这个 C 块应该出现然后你滚动到最后。 我把所有的 A,B,C 块放在 UIScrollView 下,但是 A 块不滚动。

【问题讨论】:

  • 在您的 sotryboard 中显示您的视图层次结构

标签: ios objective-c layout uiview uiscrollview


【解决方案1】:

要使片段 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

【讨论】:

    猜你喜欢
    • 2016-10-28
    • 1970-01-01
    • 1970-01-01
    • 2015-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多