Latest 1.0.1
Homepage https://github.com/joehour/PullRefresh_LoadMore
License MIT
Platforms ios 8.0, requires ARC
Authors

A PullRefresh and LoadMore TableView on iOS(swift).

Installation

CocoaPods

Check out Get Started tab on cocoapods.org.

To use ScratchCard in your project add the following ‘Podfile’ to your project

source 'https://github.com/joehour/PullRefresh_LoadMore.git'
platform :ios, '8.0'
use_frameworks!

pod 'PullRefresh_LoadMore', '~> 1.0.1'

Then run:

pod install

Example

Please check out the Example project included.

import PullRefresh_LoadMore
class ViewController: UIViewController, RefreshLoadViewDelegate {

@IBOutlet weak var table_view: UITableView!
var refreshloadView: RefreshLoadView!
var allObjectArray: NSMutableArray = []

override func viewDidLoad() {
    super.viewDidLoad()

    //add Test Data
    for i in 1...(100) {
        allObjectArray.addObject(i.description)
    }

    //Initial
    refreshloadView  = RefreshLoadView(frame: CGRectMake(95, 0, table_view.frame.width, table_view.frame.height), pic_size: CGFloat(30), insert_size: CGFloat(50))

    //have 25 item on each page
    refreshloadView.pageItems = 25

    //set Data
    refreshloadView.setData(allObjectArray)
    refreshloadView.delegate = self

    //add RefreshLoadView to tableView
    table_view.addSubview(refreshloadView)
}

//refresh data
func refreshData(view: RefreshLoadView) {

    //refresh data
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {

        sleep(1)
        dispatch_async(dispatch_get_main_queue(), {

            //end refresh
            self.refreshloadView.endRefresh(self.table_view)
        });
    });

}

//load more data 
func loadData(view: RefreshLoadView) {

    //load more data
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
        sleep(1)
        dispatch_async(dispatch_get_main_queue(), {

            //end load more
            self.refreshloadView.endLoadMore(self.table_view)
        });
    });

}

Requirements

  • iOS 8.0 or later
  • Swift 2.2 or higher
  • Xcode 7.3 or higher

License

PullRefresh_LoadMore is available under the MIT License.

Copyright © 2016 Joe.

Latest podspec

{
    "name": "PullRefresh_LoadMore",
    "version": "1.0.1",
    "license": "MIT",
    "summary": "A PullRefresh and LoadMore TableView on iOS(swift).",
    "homepage": "https://github.com/joehour/PullRefresh_LoadMore",
    "authors": {
        "joe": "[email protected]"
    },
    "source": {
        "git": "https://github.com/joehour/PullRefresh_LoadMore.git",
        "tag": "1.0.1"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "PullRefresh_LoadMore/*.{swift}",
    "resources": "PullRefresh_LoadMore/Images/*.{png}"
}

Pin It on Pinterest

Share This