I have a search bar implemented and it 'sticks' to the tableView. Now, after the tableView starts scrolling, the searchBar does not receive touches and become the first responder, instead, the cell behind it does and navigates to the next view. What can I do to make the searchBar receive touches?
Code for keeping it static:
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
UISearchBar *searchBar = self.search;
[[self.tableView.tableHeaderView superview] bringSubviewToFront:self.tableView.tableHeaderView];
CGRect searchBarFrame = searchBar.frame;
if (self.inSearchMode)
{
searchBarFrame.origin.y = 0;
}
else
{
searchBarFrame.origin.y = MAX(0, scrollView.contentOffset.y + scrollView.contentInset.top);
}
self.search.frame = searchBarFrame;
}