Giter VIP home page Giter VIP logo

zrefreshing's Introduction

ZRefreshing

CocoaPods compatible

ZRefreshing is a simple Refreshing Control for swift.

Installation

CocoaPods

<CocoaPods.org> is a dependency manager for Cocoa Projects.

use_frameworks!

pod 'ZRefreshing', '~> 1.1’

then

run pod install 

Manual

1. Download this project, And drag ZRefreshing.xcodeproj to your own project.
2. In your target’s General tab, click the ’+’ button under Linked Frameworks and Libraries.
3. Select the ZRefreshing.framework to Add to your platform. 

Usage

Header

1. add header into your tableView
var header = ZRefreshNormalHeader(target: self, action: #selector(self.loadData(_:)))
var header = ZRefreshNormalHeader({
})
self.tableView.header = header
2. start refreshing
self.tableView.header?.beginRefreshing()
3. stop refreshing
self.tableView.header?.endRefreshing()
4. hidden the last update label
header.lastUpdatedTimeLabelHidden = true
5. hidden the state label
header.stateLabelHidden = true
6. store the time with the custom key
header.lastUpdatedTimeKey = "custom key"
7. when you set a contentInset, you need set a ignored height
self.tableView.contentInset = UIEdgeInsetsMake(30, 0, 0, 0)
header?.ignoredScrollViewContentInsetTop = 30
8. also, you can set the indicator style
self.header.activityIndicatorViewStyle = .WhiteLarge



Footer

1. add auto footer into your tableView
var footer = ZRefreshAutoFooter(target: self, action: #selector(self.loadData(_:)))
self.tableView.footer = ZRefreshAutoFooter({
})
self.tableView.footer = footer
2. add normal footer into your tableView
var footer = ZRefreshBackFooter(target: self, action: #selector(self.loadData(_:)))
var footer = ZRefreshBackNormalFooter({
})
3. stop refreshing
self.tableView.footer?.endRefreshing()
self.tableView.footer?.endRefreshingWithNoMoreData()

note: you can use following function reset the refresh state

self.tableView.footer?.resetNoMoreData()
4. the footer can auto hide
self.footer.automaticallyHidden = true

note: you can set the page size for the footer, when your rows count less than pageSize auto hide the footer

self.footer.pageSize = 20
5. hidden the state label
self.footer.stateLabelHidden = true
6. when you set a contentInset, you need set the ignore height to ajust the view
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 30, 0)
self.footer.ignoredScrollViewContentInsetBottom = 30
7. also, you can set the indicator style
self.footer.activityIndicatorViewStyle = .WhiteLarge
8. disable the automic refresh for a AutoRefreshFooter
self.footer.automaticallyRefresh = false

zrefreshing's People

Contributors

zevwings avatar

Watchers

MohsinAli avatar  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.