Git Product home page Git Product logo

tcolorfultabbar's Introduction

TColorfulTabBar

彩色的TabBar,加平滑的切换动画(gif图看起来有点掉帧...)

设计图

效果展示

视图层级

这个效果的实现是通过重写TabBar,然后给TabBar添加了一个彩色view(colorView)实现的。

视图层级如下:

UITabBarController中,将系统的UITabBar替换成TColorfulTabBar即可。(注:tabBarController.tabbar属性是readonly修饰的,所以要通过KVC来修改)

代码如下:

TColorfulTabBar *tabBar = [[TColorfulTabBar alloc] initWithFrame:tabBarController.tabBar.frame];
[tabBarController setValue:tabBar forKey:@"tabBar"];

自定义

Demo相关配置在TColorfulTabBar+Configuration这个类目当中,可以修改每个item的颜色与item的个数。

// item的颜色(个数要和item的个数相同)
- (NSArray *)itemColors;

// item的个数
- (NSInteger)itemCount;

技术支持

http://www.brighttj.com/ios/ios-colorful-tabbar-implement.html

可能出现的问题

因为当TColorfulTabBar加载到父视图上时,我让TColorfulTabBar响应了自己的代理方法,所以如果在UITabBarController 中再次修改delegate ,可能会导致TColorfulTabBar无法拿到下标。

如果没有修改代理,那有可能会导致UITabBarController中的UITabBarDelegate无效。

tcolorfultabbar's People

Contributors

saitjr avatar

Watchers

James Cloos avatar Cronus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.