Skip to content

Instantly share code, notes, and snippets.

@hbhargava7
Last active May 22, 2016 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hbhargava7/9246f8e62d89ade04f8599f90affc3b8 to your computer and use it in GitHub Desktop.
Save hbhargava7/9246f8e62d89ade04f8599f90affc3b8 to your computer and use it in GitHub Desktop.
Code to implement a UIRefreshControl in a UITableView (Objective C).
/* 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