GithubHelp home page GithubHelp logo

tiwari1amrit / ctslidinguppanel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andriadze/ctslidinguppanel

0.0 1.0 0.0 115 KB

Transforms any view to sliding panel

License: MIT License

Ruby 3.31% Swift 61.08% Objective-C 2.62% Shell 31.03% C 1.95%

ctslidinguppanel's Introduction

Swift-CTSlidingUpPanel

Version License Platform

Transforms any view to sliding panel

Panel supports Anchor points, TabBarController and NavigationController, also it has basic TableView support.

Cocoapods

Add following to your Podfile:

pod "CTSlidingUpPanel"

Import(Make sure to build and clean the project):

import CTSlidingUpPanel

Manual Setup instructions

  1. Download this repository
  2. Copy files from lib folder to your project.
  3. Should be done.

How to use

You can view example project to better understand how stuff works.

But here are basic steps with Storyboard:

  1. Drag any View(Or Container View) to the parent view. DO NOT give this view any constraints.

  2. Create outlet of the view you wish to use as bottom panel

After that in your ViewController:

    @IBOutlet weak var bottomView: UIView!
    var bottomController:CTBottomSlideController?;
    

    override func viewDidLoad() {
        super.viewDidLoad()
        //You can provide nil to tabController and navigationController
        bottomController = CTBottomSlideController(parent: view, bottomView: bottomView, 
                        tabController: self.tabBarController!,
                        navController: self.navigationController, visibleHeight: 64)
        //0 is bottom and 1 is top. 0.5 would be center                
        bottomController?.setAnchorPoint(anchor: 0.7)
    }

And done, view you provided to bottomView should slide up and down.

You can do same without Storyboards. Add new subview to your parent and then provide that subview to CTBottomSlideController. It is recomended that you don't give that subview any constraints.

Delegation and stuff

  1. Add this to your ViewController
   class ViewController: UIViewController, CTBottomSlideDelegate
   {...}
  1. Set viewcontroller as a delegate
   bottomController?.delegate = self;
  1. Implement following methods
  func didPanelCollapse();
  func didPanelExpand();
  func didPanelAnchor();
  func didPanelMove(panelOffset: CGFloat);

Methods and Other stuff

Use this if you want sliding panel to slide up or down depending on TableViews offset:

func set(table:UITableView)

Use these to programatically change panels state

func expandPanel();
func anchorPanel();
func closePanel();
func hidePanel();

Use this to check panels state swift bottomController?.currentState State can be

.collapsed
.expanded
.anchored
.hidden

ctslidinguppanel's People

Contributors

andriadze avatar

Watchers

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