Reputation: 1437
I imported https://github.com/leah/PullToRefresh to my project. It works as in: I can pull down my tableview and it refreshes itself. Thing is that I don't get any text or the arrow while refreshing. I tried importing and subclassing it (works, BUT no text or arrow). And I implemented it directly into my class (Still works, but no text or arrow). Hope someone has a solution.
Here is how I call it in my class:
In my .h file I import it
#import "PullRefreshTableViewController.h"
and also subclass it
@interface Friends : PullRefreshTableViewController
In my .m file I do as told and add:
-(void)refresh {
[self performSelector:@selector(doXMLParsing) withObject:nil afterDelay:1.0];}
and put
[self stopLoading];
at the end of my method.
It does what it supposed to do, sadly without showing text or the arrow.
Upvotes: 0
Views: 562
Reputation: 12641
Use below code to simply apply pull to refresh in tableView.
Declare refreshControl in header file of your view Controller as:-
UIRefreshControl *refreshControl;
and use in implementation file as:-
refreshControl=[[UIRefreshControl alloc] init];
refreshControl.tintColor=t.tableCellSelectionColor;
[refreshControl setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Refresh Title"]];//Optional
[refreshControl addTarget:self action:@selector(reloadTable) forControlEvents:UIControlEventValueChanged];
[tblView addSubview:refreshControl];
-(void)reloadTable
{
// do your stuff here....
[tblView reloadData];
[refreshControl endRefreshing];
}
Upvotes: 1