Last active
May 22, 2016 06:29
-
-
Save hbhargava7/9246f8e62d89ade04f8599f90affc3b8 to your computer and use it in GitHub Desktop.
Code to implement a UIRefreshControl in a UITableView (Objective C).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Created by Hersh Bhargava of H2 Micro (www.h2micro.com) */ | |
//Header | |
UIRefreshControl *refreshControl; | |
//Main Load | |
refreshControl = [[UIRefreshControl alloc] init]; | |
[tableView addSubview:refreshControl]; | |
//Main Begin Refresh | |
[refreshControl beginRefreshing]; | |
[refreshControl setHidden:false]; | |
[tableView setContentOffset:CGPointMake(0, -refreshControl.frame.size.height) animated:YES]; | |
//Main Ends Refresh | |
[refreshControl endRefreshing]; | |
[refreshControl removeFromSuperview]; | |
[tableView reloadData]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment