Hassan Zaheer Hassan Zaheer - 14 days ago 5
iOS Question

Pull to refresh on UITableView Inside a UIViewController

I am trying to implement the pull to refresh functionality in my application. The architecture is such that the there is a

UITableView
inside a
UIViewController
. I want to be able to refresh the tableview on pull down. I tried the code below in the
viewDidLoad
method, but it does not work. Can any one tell me where am I wrong in implementation?

UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
refresh.tintColor = [UIColor grayColor];
refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
[refresh addTarget:self action:@selector(get_vrns) forControlEvents:UIControlEventValueChanged];
[self.vrnTable addSubview:refresh];

Answer

UIRefreshControl without UITableViewController

Or you can use UITableViewController instead of a UIViewController.