I'm trying to get a behavior like the Mail app where there is a UISearchBar
and you can pull to refresh the search results. Currently, I have the Search Display Controller with the UISearchBar
connected in IB and everything works fine (I can refresh when in the main tableview
and I can search).
But when I search and try to pull to refresh the search results (like the mail app), there is no UIRefreshControl
. Check the video below:
I guess I have to make the UISearchBar
the headerView
of the tableView
but I can't reference the UISearchBar
since it's an outlet of the Search Display Controller in IB. Here is my code for the UIRefreshControl
:
//Pull to Refresh
refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(pullToRefresh)
forControlEvents:UIControlEventValueChanged];
[self.carTableView addSubview:refreshControl];
I'm using the above code in the -viewDidLoad
method of the UIViewController
that contains the tableView