I’ve got a UISearchBar on my UITableView and a method -finishSearching which looks like this:
- (void)finishSearching {
[overlayViewController.view removeFromSuperview];
if ([sb isFirstResponder])
[sb resignFirstResponder];
myTableView.scrollEnabled = YES;
}
This method gets called everytime I want to stop searching. Be it using the cancel or the search button or just tapping on the UITableView. The problem is that I always get an EXC_BAD_ACCESS when it comes to [sb resignFirstResponder]; and I have no idea why. My goal is to implement a behavior like in Address Book where you can tap the searchBar which makes it stick to the top and put that grey overlay over the UITableView.
Any suggestions on that one?
Best
–f
Are you sure that by
removeFromSuperviewthesbwill not be released a little too early? Try resigning first and then removing the view from the superview.