Giter Site home page Giter Site logo

gradualtabbarcontroller's Introduction

GradualTabBarController

上图:

TabBarColorAnimation

iOS 视图控制器转场详解时看到了 WXTabBarController 的 TabBar 颜色渐变效果,试图在 UITabBarController 的转场过程中给 TabBar 加上渐变动画效果,当时遇到了点问题没完成,最近想起来了,解决了。

方法是获取 UITabBar 的内部视图结构,如果你没有 Reveal 这个软件,用 Xcode 自身的 ViewDebugging 也很方便,快速入门教程:raywenderlich 家出品的 View Debugging in Xcode 6

图胜千言:

UITabBar's subViews

WXTabBarController's TabBar

在原来的图标后面添加选中状态的图标,更新它们的 alpha 值就可以了。WXTabBarController采用了 UIScrollView 来实现传统的转场效果,UIScrollView 在滑动过程直至结束都会调用- (void)scrollViewDidScroll:(UIScrollView *)scrollView,在这里实时更新 alpha 值就可以了。

而在交互转场中实现这个效果时,由于 UITabBarController 自身对 TabBar 的限制,会比较麻烦一点。SEGradualTabBarController 对 TabBar 的处理是下面这样的:

SEGradualTabBarController's TabBar

大体就是这样,剩下的看代码吧。

掌握了内部视图结构,传统的 UIView 动画就可以派上用场了,可以玩出花来。

gradualtabbarcontroller's People

Contributors

seedante avatar

Watchers

James Cloos avatar  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.