如何在iOS中制作水平可滚动的UITabBar? [英] How to make a horizontal scrollable UITabBar in iOS?

查看:91
本文介绍了如何在iOS中制作水平可滚动的UITabBar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中的UITabBar包含10个以上的项目,但宽度足以放入所有10个项目。

The UITabBar in my app consists of 10+ items, but the width is enough to put all 10+ items.

如何在iOS中制作水平滚动UITabBar ?

How to make a horizontal scrollable UITabBar in iOS ?

谢谢。

推荐答案

你必须滚动你的至少在一定程度上拥有。

You'll have to roll your own to at least some extent.

可能 的工作原理是创建一个UITabBar视图(而不是控制器)并将其嵌入UIScrollView中。然后,您可以通过将其添加到TabBarController.view / tabBarView或其他内容来使用它代替常规Tab Bar控件。当然,你必须四处玩才能让它看起来正确,我不确定是否只是将视图设置得更宽,实际上会让它显示更多项目。

What might work, would be to create a UITabBar view (not the controller) and embedded it in a UIScrollView. You could then use that in place of your regular Tab Bar control by adding it to your TabBarController.view/tabBarView or something. Of course you'd have to play around to get it to look right, and I'm not sure if just setting the view to something wider will actually make it display more items or not.

当然,为了获得最佳效果,您可能想要做一些完全自定义的事情。

Of course, for best results you'd probably want to do something entirely custom.

这篇关于如何在iOS中制作水平可滚动的UITabBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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