Code Monkey home page Code Monkey logo

refresh's Introduction

RefreshView

This library provides three loading method in UITableView or UICollectionView: pull to refresh, scroll to bottom to refresh and loading.

It provides:

  • An CustomRefreshLoadingView loading when view first loaded.
  • An CustomRefreshHeaderView pulling to refresh.
  • An CustomRefreshFooterView scrolling to bottom to refresh.

demo gif(https://github.com/teambition/RefreshView/blob/master/demo.gif)

How To Use

Using CustomRefreshLoadingView

Show loading view

tableView.showLoadingView = true
collectionView?.showLoadingView = true

Hide loading view:

tableView.showLoadingView = false
collectionView?.showLoadingView = false

Using CustomRefreshHeaderView

Support RefreshHeaderView:

// UICollectionView
self.collectionView.refreshHeader = CustomRefreshHeaderView.headerWithRefreshingBlock({
// do something 
// end refresh header view
self.collectionView.refreshHeader?.endRefreshing()
})

// UITableView
self.tableView.refreshHeader = CustomRefreshHeaderView.headerWithRefreshingBlock({
// do something 
// end refresh header view
self.collectionView?.refreshHeader.endRefreshing()
})

Using CustomRefreshFooterView

Support RefreshFooterView:

// UICollectionView
self.collectionView.refreshFooter = CustomRefreshFooterView.footerWithLoadingText("Loading More Data", startLoading: {
// do something 
// end refresh and determine whether to display 
self.collectionView.refreshFooter.showLoadingView = yourCondition 
})

// UITableView
self.tableView.refreshFooter = CustomRefreshFooterView.footerWithLoadingText("Loading More Data", startLoading: {
// do something 
// end refresh and determine whether to display 
self.tableView.refreshFooter.showLoadingView = yourCondition 
})

Installation

There are two ways to use RefreshView in your project:

  • using carthage
  • copying all the files into your project

Installation with Carthage (iOS 8+)

Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.

To install with carthage, follow the instruction on Carthage

Cartfile

github "teambition/RefreshView"

Installation by cloning the repository

In order to gain access to all the files from the repository, you should clone it.

git clone --recursive https://github.com/teambition/RefreshView.git

Licenses

All source code is licensed under the MIT License.

refresh's People

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.