Reputation: 16841
I have a UIViewCOntroller
, and i have added 2 tableviews
, and 3 textfields
to it. The order of UI view controls are as follows;
1.) tableview - A - present in the first 1/2 2.) textFields 3.) tableVIew - B
I need to add the pullTorefresh
functionality to the B
tableView, How can i do this. I have tried several libraries (PullToRefresh
, EGOTableViewPullRefresh
)
Can someone give me sample code which suits my scenario.
Something like this image, (the image shows Sections
, but i have done mine using seperate Tableviews
, and mine has 3 textfields in between the 2 tableview
). I need the 2nd tableview
to have the PullToRefresh
functionality.
note: Please don't tell me to try PullToRefresh
, EGOTableViewPullRefresh
and it doesn't address my scenario. But, if you had tried it and if it works please do help me.
Upvotes: 0
Views: 1057
Reputation: 931
iOS 6 added new control - pull-to-refresh control available for UITableViewControllers.
add following code in ViewDidLoad-
- (void)viewDidLoad
{
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh)
forControlEvents:UIControlEventValueChanged];
[self.tableViewB addSubview:refreshControl];
}
- (void)refresh
{
//write your code here
// for example
[self.tableViewB reloadData];
}
-(void)stopLoading
{
//after completing your action,stop loading now
[refreshControl endRefreshing];
}
Upvotes: 1