I have got a tableview with prototype cells.
I have got the following code in my viewDidLoad method,
_refreshControl = [[UIRefreshControl alloc]init];
[_refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];
UITableViewController *tableViewController = [[UITableViewController alloc] init];
tableViewController.tableView = _tblView;
tableViewController.refreshControl = _refreshControl;
Following is my refreshData method....
-(void)refreshData
{
[_request getApproveStatutoryMapping];
UITableViewController *tableViewController = [[UITableViewController alloc] init];
tableViewController.tableView = _tblView;
[_tblView reloadData];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MMM d, h:mm a"];
NSString *title = [NSString stringWithFormat:@"Last update: %@", [formatter stringFromDate:[NSDate date]]];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:[UIColor whiteColor]
forKey:NSForegroundColorAttributeName];
NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:title attributes:attrsDictionary];
tableViewController.refreshControl.attributedTitle = attributedTitle;
[tableViewController.refreshControl endRefreshing];
}
The problem is that
- attributedTitle is not visible
- The pull to refresh works only once and If i pull it again , it does not work. Why is that so?