简体   繁体   English

Xcode 9 Swift 4选项卡式页面

[英]Xcode 9 Swift 4 Tabbed Page

在此处输入图片说明

I know how to use tabBarController. 我知道如何使用tabBarController。 But I dont Know How to Create A Tabbed Page Like The Attached Image. 但我不知道如何创建一个如附件图像的选项卡式页面。 Whats The Name Of This Type Of Tab? 这种标签的名称是什么?

This is not any type of Tab. 这不是任何类型的选项卡。 You can use a collectionView or a stackView for " Tabs " and a UIPageViewController for changing viewControllers. 您可以将collectionView或stackView用于“ Tabs ”,并将UIPageViewController用于更改viewController。

You can check CocoaControls for similar controls, download source code and check their construction. 您可以检查CocoaControls中的类似控件,下载源代码并检查其构造。 You can possible do it with SegmentedControls (Or Custom UIViews for single Tab and draw in ScrollView) and UIScrollView as Content View (with Pagination On) as well, but it depends how much customisation is needed. 您也可以使用SegmentedControls(或对单个Tab使用Custom UIViews并在ScrollView中进行绘制)和UIScrollView作为Content View(启用Pagination)来进行此操作,但这取决于需要多少自定义。

Trust me, it's REALLY tricky to obtain what you want with the iOS components. 相信我,使用iOS组件来获取想要的东西真的很棘手。 There are a lot of details that you will miss. 您会错过很多细节。 When I tried myself to build the same thing, it was like "ok I think I am reinventing the wheel, is not straight forward as I though, it require a lot of work" You know you have to consider a lot of stuff like an User that start to scroll as a crazy between the pages and then tap on one tab bar button, and so on. 当我尝试自己制造相同的东西时,就像“好吧,我认为我正在重新发明轮子,虽然不是直截了当的,它需要很多工作”。您知道您必须考虑很多东西,例如开始疯狂浏览页面的用户,然后点击一个标签栏按钮,依此类推。 Trust me, it's easy to have a working implementation, but it's really really difficult to obtain a PERFECT implementation 相信我,有一个可行的实现很容易,但是要获得一个完美的实现真的很困难

I decided to go for a library 我决定去图书馆

but there are others that are all good to achieve what you want 但是还有其他一些都可以很好地实现您想要的目标

Anyway if you want to go for your personal implementation I suggest a Segmented Control in the upper side and a PageViewController (maybe inside a Container View) 无论如何,如果您想进行个人实施,我建议在上方建议一个分段控件和一个PageViewController(也许在Container View中)

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

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