问题描述
如何创建自定义tabbar控制器,该控制器具有自定义背景图像,自定义图标以及自定义标签和定位,但与UITabBarController具有完全相同的用途。我非常寻求最佳解决方案。
How to create an custom tabbar controller which has custom background image, custom icons, and custom labels and positioning but serves exactly the same purpose as UITabBarController. I badly seeking for an optimal solution for this.
当我学习解决方案时,这将真正帮助我编写通用包装并节省更多时间。
When i learn the solution this will really help me to write a generic wrapper and save more time.
我尝试过使用UIViews并将其分别作为页脚和横幅,但这一切都消耗了大量内存。我想要一个简单的方法,这将使开发非常理想。
I have tried having UIViews and making it as footer and banner seperately, but it all consumes lots of memory. I want a simplistic approach which will make the development very optimal.
请帮助我的朋友。
推荐答案
- 创建一个包含2个子视图的视图(在IB或代码中) - 一个用于标签,一个用于内容
- 创建视图控制器将引用两个视图
- 根据需要设计标签视图(顺便说一句,它也可能位于内容视图之上)
- 在标签视图上删除几个设计按钮
- 每个按钮将删除所有内容视图的子视图,并将一些视图控制器的视图添加为内容视图的唯一子视图
- Create a view (in IB or in code) that will contain 2 subviews - one for tabs and one for content
- Create view controller that will have references to both views
- Design the tabs view as you want (BTW it may also be on top of the content view)
- Drop few designed buttons on the tabs view
- Each button will remove all the content view's subviews and add some view controller's view as a content view's only subview
这篇关于如何创建自定义tabBarController来模拟uiTabBarController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!