Approach to make a custom tabBar

ⅰ亾dé卋堺 提交于 2019-12-06 07:27:38

问题


What should be the best way to create a effect like this and the handling of navigation controllers and view controllers ... what to do if I don't want to re-size each subsequent view in viewcontorller and things appear as if it is a tabBar


回答1:


I would recommend using an UIImageView for the blue background, then 5 UIButtons of custom type with PNG images for the actual buttons.

Subclass UIView and put all the code to set up the background and buttons in the init function. That way you can easily place your custom TabBar wherever you like.

The individual buttons also allow you to easily animate them for transitions if you want.

Update to reflect updated question:

If you want the actual UITabBar functionality, things become much more complex.

You have three basic options:

a) Implement the functionality you need from scratch in your new class

b) Subclass UITabBar and try to override the drawing code with the code above

c) Take a look at already existing alternative implementations of UITabBar and base your new class on one of them. This will probably be the easiest solution.



来源:https://stackoverflow.com/questions/6383873/approach-to-make-a-custom-tabbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!