5

I have a UITableview that doesn't take up the whole screen (screenshot). Everything worked fine in iOS 6. But in iOS 7, when the user searches, the search result table takes up the whole view (screenshot).

To fix this, I tried setting the frame manually as described in this answer. The appearance is now correct (screenshot), but now the "<" button in the top left doesn't receive tap events when the search results table is displayed.

It seems the searchResultsTableView is adding a full-screen background view that is intercepting touch events. To prove this, I added this code to didShowSearchResultsTableView:

   controller.searchResultsTableView.superview.backgroundColor = [UIColor blueColor];`

This screenshot confirms my hypothesis.

How can I fix this to allow the "<" button to receive tap events? I want to avoid modifying controller.searchResultsTableView.superview so that my change doesn't break in future versions of iOS.

And what change in iOS 7 caused this behavior to start happening?

Community
  • 1
  • 1
tba
  • 6,229
  • 8
  • 43
  • 63
  • 2
    TIPS: It's a new standard in iOS 7 to always have the searchbar in the navigationbar. You can do that with `UISearchDisplayController.displaysSearchBarInNavigationBar = YES;` You can put a UIBarButton to show the searchbar. – Gustaf Rosenblad Sep 20 '13 at 20:54
  • It's unclear to me why you're getting those results. Filing a bug with a minimal sample app would be extremely useful. – MyztikJenz Sep 20 '13 at 22:00
  • thanks man your reasearch saved my lot of time.. could solve [my](http://stackoverflow.com/questions/19291670/mapview-not-scrollable-touchable-in-ios-7) problem – the1pawan Oct 10 '13 at 09:52

1 Answers1

2

I am still searching for a better solution, but currently my solution is in the viewControllers viewDidLayoutSubviews tell your view to move to front. The code would look something like this.

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];

    [self.view bringSubviewToFront:self.navigationBar];
}
cnotethegr8
  • 7,342
  • 8
  • 68
  • 104