Giter Site home page Giter Site logo

kizbehavior's Introduction

KIZBehavior

KIZBehavior是基于组合设计模式,并且充分利用Interface Builder来实现某些功能的代码集,旨在通过低耦合、低侵入、组件化、少代码甚至无代码化的形式来实现一些功能。

KIZBehavior遵循组合模式,代码遵循功能单一原则并且可以使我们的类简化,可以通过组合多个behavior来定制较为复杂的效果,并且在Interface Builder中提供丰富的参数设置,无需编码也可以通过参数来调整效果。

更多关于Behavior模式的信息请看这篇文章:iOS中的行为 英文原版:Behaviors in iOS Apps

目前KIZBehavior实现的功能有:

  1. KIZParallaxHeaderBehavior: UIScrollView 头部图片视差效果
  2. KIZNavBarGradientBehavior: NavigationBar 透明渐变动画效果

###KIZParallaxHeaderBehavior UIScrollView头部图片拉伸效果 ####features

  • 0行代码集成
  • 图片等比例拉伸
  • IB设置视差效果参数

####How to Use 在IB中设置UIScrollView的delegate为KIZParallaxHeaderBehavior即可

parallax header

###KIZNavBarGradientBehavior 导航栏渐变动画效果 ####features:

  • 导航栏透明度渐变
  • 导航栏上文字及图表的颜色渐变
  • 状态栏颜色变化
  • 自动保存初始及离开界面时的状态,退出或返回界面时自动恢复原来状态
  • IB设置相关参数

####How to use 在controller的viewWillAppear viewWillDisappear 中分别调用两个方法,并且设置UISCrollView的delegate为KIZNavBarGradientBehavior即可

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    [self.navBarBehavior onViewWillAppear];
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    [self.navBarBehavior onViewWillDisAppear];
}

NavigationBar animation

###KIZParallaxHeaderBehavior + KIZNavBarGradientBehavior 组合效果 ####How to use 需要设置UIScrollView的delegate为KIZMultipleProxyBehavior,并且将需要组合的behavior添加到MultipleProxyBehavior中即可。 Parallax + NavigationBar

kizbehavior's People

Contributors

zziking avatar

Watchers

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