In a project development process for a better experience will often use the drop-down refresh update data, of course, with some pull-up loading more data, the current comparison of fire Egotableviewpullrefresh only realized the pull-down function, but not the function of pull-up. Here you'll find a library that integrates both pull-down refreshes and pull-up loads more Egotableviewpullrefresh
English original and class library: Https://github.com/emreberge/EGOTableViewPullRefresh
Demo effect included
Whats different on this fork:
Easy to integrate and configure with Interface Builder add TableView.
Simple configuration, arrow Head, background color and text color can be easily changed by Pulltableview class properties.
Pull-up loads more data functions at the bottom of the table.
You can refresh and load more animations with code modifications.
The FAST setup:
Add Quartzcore.framework to your project.
Drag the Egotableviewpullrefresh to your project directory.
View the properties available for the PullTableView.h file.
Add a Pulltableview to your code to implement the Pulltableviewdelegate delegate method.
Enjoy it.
The detailed setup (Walk through for creating the demo project):
Create a new Xcode project
Select the View Based application template (Xcode 4.2 is a single view application template)
Project Name Egotableviewpullrefreshdemo
Creating a Egotableviewpullrefreshdemoviewcontroller controller class under a project file (single View application template does not require this step)
Adding Quartzcore.framework to the project
Add Pulltableview to Project:
Drag and drop the file under the Egotableviewpullrefresh directory under the project support file group to make sure that the files under (Egotableviewpullrefresh) are copied to the target filegroup.
Add pulltable view to Egotableviewpullrefreshdemoviewcontroller.xib:
Drag a UITableView control onto the view view.
Open Identity Inspector to change the table's inheriting class from UITableView to Pulltableview
Connect the DataSources data source and the Pulldelegate protocol to the File ' s owner of Pulltableview
Configure the View controller's header file EGOTableViewPullRefreshDemoViewController.h:
Add #import "PullTableView.h"
Declaring the pulltableviewdelegate and Uitableviewdatasource agreements
Create a output with a property named Pulltableview connected to the TableView on interface Builder
Configure view controller and footer EGOTABLEVIEWPULLREFRESHDEMOVIEWCONTROLLER.M
Add the following code to the. m file
[CPP] View plaincopy
#pragma mark-refresh and load more methods
-(void) refreshtable
{
/*
Code to actually the refresh goes here. The refresh code is placed here
*/
Self.pullTableView.pullLastRefreshDate = [NSDate Date];
self.pullTableView.pullTableIsRefreshing = NO;
}
-(void) loadmoredatatotable
{
/*
Code to actually load more data goes here. Load more implementation code put in here
*/
Self.pullTableView.pullTableIsLoadingMore = NO;
}
#pragma mark-uitableviewdatasource
-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView
{
return 5;
}
-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section
{
return 10;
}
-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath
{
static NSString *cellidentifier = @ "Cell";
UITableViewCell *cell = [TableView dequeuereusablecellwithidentifier:cellidentifier];
if (!cell) {
cell = [[UITableViewCell alloc] Initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];
}
Cell.textLabel.text = [NSString stringwithformat:@ "Row%i", Indexpath.row];
return cell;
}
-(NSString *) TableView: (UITableView *) TableView titleforheaderinsection: (nsinteger) Section
{
return [nsstring stringwithformat:@ ' section%i begins here! ', section];
}
-(NSString *) TableView: (UITableView *) TableView titleforfooterinsection: (nsinteger) Section
{
return [nsstring stringwithformat:@ ' section%i ends here! ', section];
}
#pragma mark-pulltableviewdelegate
-(void) Pulltableviewdidtriggerrefresh: (Pulltableview *) Pulltableview
{
[Self performselector: @selector (refreshtable) Withobject:nil afterdelay:3.0f];
}
-(void) Pulltableviewdidtriggerloadmore: (Pulltableview *) Pulltableview
{
[Self performselector: @selector (loadmoredatatotable) Withobject:nil afterdelay:3.0f];
}
For UI configuration, add the following code to the Viewdidload () method (e.g., change the background color of the refresh and pull arrow heads, etc.)
[CPP] View plaincopy
Self.pullTableView.pullArrowImage = [UIImage imagenamed:@ "Blackarrow"];
Self.pullTableView.pullBackgroundColor = [Uicolor Yellowcolor];
Self.pullTableView.pullTextColor = [Uicolor blackcolor];
You can use the Pulltableisrefreshing and Pulltableisloadingmore properties for manual animation settings. For example, add the following code to the Viewwillappear: method
[CPP] View plaincopy
if (!self.pulltableview.pulltableisrefreshing) {
self.pullTableView.pullTableIsRefreshing = YES;
[Self performselector: @selector (refreshtable) Withobject:nil Afterdelay:3];
}
iOS Refresh Data