0

I have a UISearchBar working to dynamically show matching results from a list, but having a nightmare trying to stop the searchResultsTableView from obscuring the resultant UIView, which animates in from the right, when the result is tapped.

The magenta view, (including its shadow subview) and the solid black view should be above the list.

enter image description here

I've tried…

self.searchDisplayController.searchResultsTableView.layer.zPosition = 0;
recipeMeasuresView.layer.zPosition = 1;
recipeListView.layer.zPosition = 2;

…but it's messing up the gestures attached still not displaying the views in the correct order. I've also tried…

[self.view sendSubviewToBack:_searchBar];
[ingredientListView bringSubviewToFront:ingredientListView];

…still no joy. Incidently, I'm also adding – amongst other things – [_searchBar resignFirstResponder]; to my

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

I'm very much an objective-C newbie so all help greatly appreciated.

matt_goodall
  • 81
  • 1
  • 7

1 Answers1

1

In case anybody else stumbles across this with similar problems it seems that the issue is due to the searchDisplayController adding it's own view(s) at the top of the stack, therefore obscuring anything that was added to the storyboard.

There would be no way to push anything up or down to change the order because the searchDisplayResultsTable was being added by a different view controller.

The solution I used was to add the views that were being hidden programatically, meaning I could add them as subviews to different parent views depending on what was happening. Probably not the best solution but it does appear to work.

matt_goodall
  • 81
  • 1
  • 7