GithubHelp home page GithubHelp logo

carabina / slidetabkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from summertian4/slidetabkit

0.0 1.0 0.0 1.52 MB

Simple and easy to use tools of slide tab / 简单易用的滑动标签栏工具

License: GNU General Public License v3.0

Ruby 6.15% Swift 93.85%

slidetabkit's Introduction

SlideTabKit

Introduction

中文介绍

SlideTabKit is a simple and easy to use tools of slide tab.

"Slide Tab Tool" and "Paging tool" can be used in combination or split.

Install

pod 'SlideTabKit'

Example

Use the SlideTabKit

var slideTabKit: SlideTabKit = SlideTabKit()
var vcs: [UIViewController] = []
var titles: [String] = ["Tab 0", "Tab 1", "Tab 2", "Tab 3"]

override func viewDidLoad() {
    super.viewDidLoad()

    for _ in 0 ..< 4 {
        let vc = UIViewController()
        vc.view.backgroundColor = UIColor.randomColor
        vcs.append(vc)
    }
    view.addSubview(slideTabKit.slideTabBar)
    slideTabKit.slideTabBar.snp.makeConstraints { (make) in
        make.top.equalTo(topLayoutGuide.snp.bottom)
        make.left.right.equalTo(view)
        make.height.equalTo(40)
    }
    slideTabKit.slideTabBar.resetting(titles: titles)

    view.addSubview(slideTabKit.slideScrollView)
    slideTabKit.slideScrollView.snp.makeConstraints { (make) in
        make.top.equalTo(slideTabKit.slideTabBar.snp.bottom)
        make.left.right.bottom.equalTo(view)
    }
    slideTabKit.slideScrollView.resetting(childViews: vcs.map({ (vc) -> UIView in
        return vc.view
    }))
}

Use SlideTabBar alone

var slideTabBar0: SlideTabBar = SlideTabBar()

override func viewDidLoad() {
    super.viewDidLoad()

    // 设置 slideTabBar
    self.view.addSubview(slideTabBar0)
    // 其他属性设置完毕后调用 resetting
    slideTabBar0.resetting(titles: ["Tab 1", "Tab 2", "Tab 3", "Tab 4"])
    slideTabBar0.delegate = self

    slideTabBar0.snp.makeConstraints { (make) in
        make.top.equalTo(self.topLayoutGuide.snp.bottom)
        make.left.right.equalTo(self.view)
        make.height.equalTo(40)
    }
}

In addition to using text to initialize the style, also support custom style.

Use SlideScrollView alone

var vcs: [UIViewController] = []

override func viewDidLoad() {
    super.viewDidLoad()

    for _ in 0 ..< 4 {
        let vc = UIViewController()
        addChildViewController(vc)
        vcs.append(vc)
        
        vc.view.backgroundColor = UIColor.randomColor
    }

    self.view.addSubview(slideScrollView)
    let views = vcs.map { (viewController) -> UIView in
        return viewController.view
    }
    slideScrollView.resetting(childViews: views)
    slideScrollView.delegate = self
    slideScrollView.snp.remakeConstraints { (make) in
        make.edges.equalTo(self.view)
    }
}

Demo

It is recommended to download the Demo to see how to use SlideTabKit.

Feature

  • "Slide Tab Tool" and "Paging tool" used in combination
  • Use SlideTabBar alone
  • Use paging tool alone
  • The text on the tab bar fades

License

SlideTabKit use GNU GENERAL PUBLIC LICENSE Version 3

Feedback

If there are any suggestions, pleas send an email to [email protected], and also welcome to my blog to discuss. Learning together~

slidetabkit's People

Contributors

summertian4 avatar

Watchers

 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.