简体   繁体   English

ScrollView具有多个视图iOS Autolayout

[英]ScrollView with multiple Views iOS Autolayout

I am a newbie iOS developer currently working for a small company. 我是一名新手iOS开发人员,目前在一家小公司工作。 I started developing iOS only some months ago and i only know how to work with Swift and AutoLayout. 几个月前我才开始开发iOS,我只知道如何使用Swift和AutoLayout。 I have a little bit of a situation since my boss asked me to do a complicated scrollable view that contains other type of views within it. 我有一点情况,因为我的老板让我做一个复杂的可滚动视图,其中包含其他类型的视图。

I made a sketch using wireframe that is available here: https://wireframe.cc/MU0PC6 , and i will also leave a print screen. 我用这里的线框做了一个草图: https//wireframe.cc/MU0PC6 ,我也会留下一个打印屏幕。 So my question is: Is this achievable using AutoLayout and Swift? 所以我的问题是:这是否可以使用AutoLayout和Swift实现? If it is can you please help me do it? 如果可以的话请你帮忙吗? If not, can you please point to a good tutorial that can help me do it using nibs? 如果没有,你能指点一个好的教程,可以帮助我使用笔尖吗?

Thank you, and sorry for my english and newbie skills. 谢谢你,对不起我的英语和新手技巧。

Here is the screenshot 这是截图 具有多个视图的Scrollview

In order to create complex scrollable layouts with different elements and sections you should use a UICollectionView. 为了创建具有不同元素和部分的复杂可滚动布局,您应该使用UICollectionView。

You can read into it here: UICollectionView Tutorial 你可以在这里阅读: UICollectionView教程

All the different parts of the layout would be individual UICollectionviewCells and you can control the size of them through UICollectionViewDelegateFlowLayout. 布局的所有不同部分都是单独的UICollectionviewCells,您可以通过UICollectionViewDelegateFlowLayout控制它们的大小。

You can also build it using just UIScrollView and AutoLayout of course but the UICollectionView approach saves you a lot of headaches and when developing for iOS the UICollectionView is one of the most vital UI components anyway. 您当然也可以使用UIScrollView和AutoLayout构建它,但UICollectionView方法可以为您节省很多麻烦,而且在开发iOS时,UICollectionView无论如何都是最重要的UI组件之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM