Git Product home page Git Product logo

arale's Introduction

License Platform Version

Arale

A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView support for reloading your content. Built for iOS 10 and later.

Demo

Example 1

Arale, by ZulwiyozaPutra

  • Compatible with UITableView, UICollectionView, or any UIScrollView subclasses.
  • Data source and delegate independency: can be added to an existing view controller without interfering with your existing delegate or dataSource.
  • No need to subclass a custom view controller or to use a custom UICollectionViewLayout.

If you are using this library in your project, I would be more than glad to know about it!

Usage

To add a stretchy header to your table or collection view, you just have to do this:

import Arale

init with optional backgroundImage

let araleHeaderView = AraleHeaderView(minHeight: 256.0, backgroundImage: myBackgroundImage)
self.tableView.addSubview(araleHeaderView)

In case you want to add a UIActivityIndicatorView, to handle action if the AraleHeaderView did resize to maxHeight you can implement a AraleHeaderViewDelegate conformed UIViewController

araleHeaderView.delegate = self

You can implement headerViewDidReachMaxHeight method to get event when the araleHeaderView did reach the maximum height

func headerViewDidReachMaxHeight(_ headerView: AraleHeaderView) {
    NSLog("%@", "Start Refreshing")
    headerView.activityIndicatorView.stopAnimating()
}

AraleHeaderViewDelegate comes with three optional delegate method

func headerViewWillResizeFrame(_ headerView: AraleHeaderView)
func headerViewDidResizeFrame(_ headerView: AraleHeaderView)
func headerViewDidReachMaxHeight(_ headerView: AraleHeaderView)

Configuration

You can add an optional UIViewActivityIndicatorView in your stretchy header view:

let myActivityIndicatorview = UIActivityIndicatorView(style: .white)
araleHeadeView.activityIndicatorView = myActivityIndicatorView

the activityIndicatorView will not be rendered if remain nil in case you don't need an activityIndicator.

Installation

Arale is available through CocoaPods. To install it, simply add the following line to your Podfile, you can check the Example Podfile to see how it looks like:

pod "Arale"

Author

Zulwiyoza Putra

Contributions

Contributions are more than welcome! If you find a solution for a bug or have an improvement, don't hesitate to open a pull request!

License

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

If your app uses Arale, I'd be glad if you reach me via Twitter or via email.

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.