开发者

Approach to make a custom tabBar

开发者 https://www.devze.com 2023-03-13 11:44 出处:网络
What should be the best way to create a effect like thisand the handling of navigation controllers and view controllers ... what to do if I don\'t want to re-size each subsequent view in viewcontorlle

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

Approach to make a custom tabBar


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号