How to Create a Custom tabBarController to simulat

2020-08-09 06:39发布

问题:

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.

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.

Please help me friends.

回答1:

  • 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