Code Monkey home page Code Monkey logo

zsnavigationbar's Introduction

ZSNavigationBar中文说明

ZSNavigationBar uses category to allow you change UINavigationBar appearance dynamically.(supported iOS 11+)

Installation

CocoaPods

  • Swift:
  1. Add pod 'ZSNavigationBar' to your Podfile.
  2. Run pod install or pod update.
  3. Import ZSNavigationBar.
  • Objective-c:
  1. Add pod 'ZSNavigationBar-oc' to your Podfile.
  2. Run pod install or pod update.
  3. Import ZSNavigationBar.

Manually

  1. Add all files under Source-oc or Source-swift folder.
  2. Link with required frameworks: UIKit.
  3. If you use oc version, just import UINavigationBar+custom.h.

Requirements

  • iOS 8+
  • Xcode 9+
  • swift 3.0+
  • Objective-c

Usage

  • Swift:

The category includes several methods that helps to change UINavigationBar's appearance dynamically:

func setCustomBackgroundColor(_ backgroundColor: UIColor)
func setCustomTranslationY(translationY: CGFloat)
func reset()

And usually in viewWillDisappear, you should call this method to avoid any side effects:

override func viewWillDisappear(_ animated: Bool) {
  super.viewWillDisappear(animated)
  self.navigationController?.navigationBar.reset()
}
  • Objective-c:

First, import this lib:

#import "UINavigationBar+Custom.h"

The category includes several methods that helps to change UINavigationBar's appearance dynamically

- (void)zs_setBackgroundColor:(UIColor *)backgroundColor;
- (void)zs_setTranslationY:(CGFloat)translationY;
- (void)zs_reset;

And usually in viewWillDisappear, you should call this method to avoid any side effects:

- (void)viewWillDisappear:(BOOL)animated {
  [super viewWillDisappear:animated];
  [self.navigationController.navigationBar zs_reset];
}

License

ZSNavigationBar is available under the MIT license. See the LICENSE file for more info.

zsnavigationbar's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zsnavigationbar's Issues

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.