I want to implement Pull To Refresh in UITableViewControllerusing UIRefreshControl. Here is what I have tried so far.
- (void)viewDidLoad
{
.....
UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
refresh.tintColor = [UIColor magentaColor];
[refresh addTarget:self action:@selector(pullToRefresh:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refresh;
}
-(void)pullToRefresh:(UIRefreshControl *)refresh {
[refresh beginRefreshing];
refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Refreshing.."];
[self loadRecentActivities];
}
But when I pull out the table view, neither the activity indicator nor the title are visible, however the pullToRefreshtable is called and updated. My application supports iOS7.0 + . What am I missing? Any help would be appreciated?
Edit: I tried with [self.refreshControl setEnabled:YES];and [self.refreshControl setEnabled:YES];, as mentioned in my edited code, but still no luck. This is what my table view looks like when I pull it out for an update -
Final Solution: For the table table background I used
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]];
self.tableView.backgroundView = imageView;
self.tableView.backgroundView,
[self.tableView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]]];
. Balram Tiwari, , . , .