iOS 将 CollectionView 添加到故事板 UI 构建器中的另一个视图 [英] iOS add a CollectionView to a another view within the storyboard UI builder

查看:32
本文介绍了iOS 将 CollectionView 添加到故事板 UI 构建器中的另一个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚开始使用iOS,并试图使右侧的集合视图成为左侧视图的子视图.我似乎无法将其拖入.我认为部分问题是在导航的左侧部分(工作区的左侧),集合视图被称为场景.为了创建我想要将集合视图放入其中的视图,我只是将一个新的视图控制器拖到工作区中,然后通过 control+click 将其添加到主选项卡视图中.我想要集合视图上方的另一个视图,但首先要...

Just getting started with iOS, and trying to make the collection view on the right be a child view of the view on the left. I cant seem to drag it in. I think part of the problem is that on the left hand part of the nav (immediate left of the work area) the collection view is being called a scene. To create the view into which I want to put the collection view, I just dragged a new view controller into the work area, then did the control+click to add it to the main tab view. I am going to want another view above the collection view, but first things first...

我必须以编程方式执行此操作吗?

Do I have to do this programmatically?

推荐答案

UIScrollView:UIView 固有的 UICollectionView,因此您可以添加到您的 IB 或代码中:

UICollectionView inherent from UIScrollView:UIView, so you can add in your IB or in code:

像tableView一样,拖拽delegate和datasource到ViewController.如果你想要更多collectiotionView,创建更多flowlayouts.

Like tableView, drag delegate and datasource to ViewController.If you want more collectiotionView, create more flowlayouts.

这篇关于iOS 将 CollectionView 添加到故事板 UI 构建器中的另一个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆