Hi,
Everyone,
Did you ever use "Custom Refresh Control" in your iOS application? I recently implemented this concept in my one of code. There's a ready-made control available called "ODRefreshControl".
You just need to import to files into your project resource. "ODRefreshControl.h" & "ODRefreshControl.m". Please check below lines to use it in your code.
*******For Example :
1) Import Files : "ODRefreshControl.h" & "ODRefreshControl.m"
2) Put this into your class file.
- (void)viewDidLoad
{
ODRefreshControl *refreshControl = [[ODRefreshControl alloc] initInScrollView:tbl_tableView]; // Assign your view in which you want to use it. I used it in my UITableViewController.
[refreshControl addTarget:self action:@selector(dropViewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged];
[super viewDidLoad];
}
#pragma mark ---------------
#pragma mark UITableView Pull-To-Refresh Management
#pragma mark ---------------
- (void)dropViewDidBeginRefreshing:(ODRefreshControl *)refreshControl
{
double delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[refreshControl endRefreshing];
// write your own refresh method here which you want to call.
});
}
Thanks,
Nilesh M. Prajapati
Everyone,
Did you ever use "Custom Refresh Control" in your iOS application? I recently implemented this concept in my one of code. There's a ready-made control available called "ODRefreshControl".
You just need to import to files into your project resource. "ODRefreshControl.h" & "ODRefreshControl.m". Please check below lines to use it in your code.
*******For Example :
1) Import Files : "ODRefreshControl.h" & "ODRefreshControl.m"
2) Put this into your class file.
- (void)viewDidLoad
{
ODRefreshControl *refreshControl = [[ODRefreshControl alloc] initInScrollView:tbl_tableView]; // Assign your view in which you want to use it. I used it in my UITableViewController.
[refreshControl addTarget:self action:@selector(dropViewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged];
[super viewDidLoad];
}
#pragma mark ---------------
#pragma mark UITableView Pull-To-Refresh Management
#pragma mark ---------------
- (void)dropViewDidBeginRefreshing:(ODRefreshControl *)refreshControl
{
double delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[refreshControl endRefreshing];
// write your own refresh method here which you want to call.
});
}
Thanks,
Nilesh M. Prajapati
No comments:
Post a Comment